Commit fab7e5d5 authored by 高诸锋's avatar 高诸锋

【del 定时任务】

parent b1de9727
Pipeline #5739 passed with stage
in 15 seconds
'use strict';
module.exports = {
schedule: {
interval: '5m', // 5分钟间隔
type: 'all', // 所有woker
immediate: true,
},
async task(ctx) {
try {
const dbRes = await ctx.cusPro.query('SELECT app_key FROM customer_product WHERE goods_sn = 108 AND state = 1', {
type: 'SELECT',
});
const arr = [];
for (const item of dbRes) {
arr.push(item.app_key);
}
ctx.app.appKeyArr = arr;
} catch (e) {
ctx.logger.error('【schedule/flash_cus_pro】catch error:', e);
}
},
};
'use strict';
module.exports = app => {
return {
schedule: {
interval: '5m', // 5分钟间隔
type: 'all',
immediate: true,
},
// 定时操作node_gjj.node_limit表
async task(ctx) {
const rows = await ctx.nodeGjj.query('SELECT appKey, currentCount, limitCount, text FROM node_limit WHERE type = shebao', { type: 'SELECT' });
const map = new Map();
rows.forEach(item => {
const { currentCount, limitCount, text } = item;
const obj = {
currentCount,
limitCount,
env: text,
};
map.set(item.appKey, obj);
});
ctx.app.modeLimitMap = map;
},
};
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment