peng.peng
1 year ago
4 changed files with 45 additions and 14 deletions
@ -0,0 +1,33 @@ |
|||||
|
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, |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue