(req, res, next)
| 11 | |
| 12 | } |
| 13 | async apiCount(req, res, next){ |
| 14 | const date = req.params.date; |
| 15 | if (!date) { |
| 16 | console.log('参数错误') |
| 17 | res.send({ |
| 18 | status: 0, |
| 19 | type: 'ERROR_PARAMS', |
| 20 | message: '参数错误' |
| 21 | }) |
| 22 | return |
| 23 | } |
| 24 | try{ |
| 25 | const count = await StatisModel.find({date}).count() |
| 26 | res.send({ |
| 27 | status: 1, |
| 28 | count, |
| 29 | }) |
| 30 | }catch(err){ |
| 31 | console.log('获取当天API请求次数失败'); |
| 32 | res.send({ |
| 33 | status: 0, |
| 34 | type: 'ERROR_GET_TODAY_API_COUNT', |
| 35 | message: '获取当天API请求次数失败' |
| 36 | }) |
| 37 | } |
| 38 | } |
| 39 | async apiAllCount(req, res, next){ |
| 40 | try{ |
| 41 | const count = await StatisModel.count() |
nothing calls this directly
no outgoing calls
no test coverage detected