egg_server/schedule/index.ts

16 lines
570 B
TypeScript

import schedule from "node-schedule"
import report from "../controller/groupAgent/report"
import sendZhongNotify from "./zhongNotify"
export const initSchedule = async () => {
// 定时任务,每周一到周四晚上 8 点 0 分 0 秒执行
schedule.scheduleJob("0 20 * * 1-4", () => report.genAllReport("daily"))
// 定时任务,每周五晚上 8 点 0 分 0 秒执行
schedule.scheduleJob("0 20 * * 5", () => report.genAllReport("weekly"))
// 定时任务,每天早上 6 点 0 分 0 秒执行
schedule.scheduleJob("0 6 * * *", sendZhongNotify)
}