You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
1.0 KiB
34 lines
1.0 KiB
1 year ago
|
const moment = require('moment')
|
||
|
const { refresh } = require('../utils/waterCache');
|
||
|
|
||
|
module.exports = function (app, opts) {
|
||
|
const { models } = app.fs.dc
|
||
|
|
||
|
const freshWater = app.fs.scheduleInit(
|
||
|
{
|
||
|
interval: '0 * * * * *',
|
||
|
// interval: '*/3 * * * *',
|
||
|
immediate: true,
|
||
|
// proRun: true,
|
||
|
},
|
||
|
async () => {
|
||
|
try {
|
||
|
const waterCache = app.fs.waterCache
|
||
|
if (waterCache) {
|
||
|
Object.keys(waterCache).forEach(key => {
|
||
|
key.indexOf('login') > -1 ? app.fs.utils.getAnxinyunToken()
|
||
|
:
|
||
|
key.indexOf('axy/alarm') > -1 ? null :
|
||
|
app.fs.utils.getDataFromAxy(key, 'get', {})
|
||
|
})
|
||
|
}
|
||
|
} catch (error) {
|
||
|
app.fs.logger.error(`sechedule: freshYingshiState, error: ${error}`)
|
||
|
}
|
||
|
});
|
||
|
|
||
|
return {
|
||
|
freshWater,
|
||
|
}
|
||
|
}
|