(req, res, next)
| 118 | } |
| 119 | } |
| 120 | async orderCount(req, res, next){ |
| 121 | const date = req.params.date; |
| 122 | if (!date) { |
| 123 | console.log('参数错误') |
| 124 | res.send({ |
| 125 | status: 0, |
| 126 | type: 'ERROR_PARAMS', |
| 127 | message: '参数错误' |
| 128 | }) |
| 129 | return |
| 130 | } |
| 131 | try{ |
| 132 | const count = await OrderModel.find({formatted_created_at: eval('/^' + date + '/gi')}).count() |
| 133 | res.send({ |
| 134 | status: 1, |
| 135 | count, |
| 136 | }) |
| 137 | }catch(err){ |
| 138 | console.log('获取当天订单数量失败'); |
| 139 | res.send({ |
| 140 | status: 0, |
| 141 | type: 'ERROR_GET_ORDER_COUNT', |
| 142 | message: '获取当天订单数量失败' |
| 143 | }) |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | export default new Statis() |
nothing calls this directly
no outgoing calls
no test coverage detected