const zhidiaoSystem = require('../../../utils/zhidiaoSystem.js'); const moment = require('moment') let isDev = false isDev = true module.exports = function (app, opts) { const busLines = app.fs.scheduleInit( { interval: '24 0 */1 * * *', immediate: true, proRun: false, disabled: false }, async () => { try { const { models, ORM: sequelize } = app.fs.dc const Authorization = zhidiaoSystem.createAuthorization() const busRunRes = await app.fs.zhidiaoRequest.get(`getBusRunList`, { header: { Authorization: Authorization } }) if (busRunRes && busRunRes.length) { if (app.fs.zhidiaoData) { app.fs.zhidiaoData.busRun = busRunRes } else { app.fs.zhidiaoData = { busRun: busRunRes } } } const busLineRes = await app.fs.zhidiaoRequest.get(`getLinePointList`, { header: { Authorization: Authorization } }) console.log(`定时获取BUS路线信息`); if (busLineRes && busLineRes.length) { if (app.fs.zhidiaoData) { app.fs.zhidiaoData.busLine = busLineRes } else { app.fs.zhidiaoData = { busLine: busLineRes } } } } catch (error) { console.error(error); } } ) return { busLines, } }