|
|
@ -4,15 +4,23 @@ async function overSpeedList (ctx) { |
|
|
|
try { |
|
|
|
const models = ctx.fs.dc.models; |
|
|
|
const { userId } = ctx.fs.api; |
|
|
|
const { limit } = ctx.query; |
|
|
|
|
|
|
|
const overSpeedRes = await models.Overspeed.findAll({ |
|
|
|
attributes: ['id', 'licensePlate', 'overrunRate', 'deductPoints', 'fine', 'processingTime'], |
|
|
|
order: [['testTime', 'DESC']], |
|
|
|
limit: limit || 120, |
|
|
|
}) |
|
|
|
|
|
|
|
const overSpeedProcessedCount = await models.Overspeed.count({ |
|
|
|
where: { |
|
|
|
processingTime: { $ne: null } |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
ctx.status = 200 |
|
|
|
ctx.body = { |
|
|
|
processed: overSpeedRes.filter(s => s.processingTime).length, |
|
|
|
processed: overSpeedProcessedCount, |
|
|
|
overSpeedList: overSpeedRes, |
|
|
|
} |
|
|
|
} catch (error) { |
|
|
|