'use strict'; const fs = require('fs'); // 将定时任务汇集未来可根据需要选取操作 module.exports = async function (app, opts) { fs.readdirSync(__dirname).forEach((filename) => { if (!['index.js'].some(f => filename == f)) { const schedule = require(`./${filename}`)(app, opts) for (let k of Object.keys(schedule)) { console.info(`定时任务 ${k} 启动`); } app.fs.schedule = { ...app.fs.schedule, ...schedule, } } }); };