5 changed files with 89 additions and 29 deletions
@ -0,0 +1,55 @@ |
|||||
|
const moment = require('moment') |
||||
|
|
||||
|
let isDev = false |
||||
|
isDev = true |
||||
|
|
||||
|
module.exports = function (app, opts) { |
||||
|
const notice = app.fs.scheduleInit( |
||||
|
{ |
||||
|
interval: '0 9 */1 * * *', |
||||
|
immediate: isDev && opts.dev, |
||||
|
proRun: !isDev, |
||||
|
disabled: false |
||||
|
}, |
||||
|
|
||||
|
async () => { |
||||
|
try { |
||||
|
const { models, ORM: sequelize } = app.fs.dc |
||||
|
console.log(123123); |
||||
|
const anomalyList = await models.Report.findAll({ |
||||
|
where: { |
||||
|
handleState: null, |
||||
|
reportType: 'anomaly', |
||||
|
time: { |
||||
|
[sequelize.Op.lt]: moment().subtract(3, 'days').format('YYYY-MM-DD HH:mm:ss') |
||||
|
} |
||||
|
}, |
||||
|
include: [{ |
||||
|
model: models.User, |
||||
|
}, { |
||||
|
model: models.Road, |
||||
|
as: 'road_' |
||||
|
}] |
||||
|
}) |
||||
|
|
||||
|
for (let i = 0; i < anomalyList.length; i++) { |
||||
|
const anomaly = anomalyList[i] |
||||
|
/** |
||||
|
* 通过XX(反馈类型)反馈,XX(所道路)的XX(所属路段)路段,具体位置于XX,XXXX(反馈内容)。XXX(上报人)上报时间:XX。您已超过3天未处理,请至平台尽快处理。 |
||||
|
*/ |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
console.log(anomalyList); |
||||
|
|
||||
|
} catch (error) { |
||||
|
console.error(error); |
||||
|
} |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
return { |
||||
|
notice, |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue