Commit 55e08f54 authored by 姚广胤's avatar 姚广胤

定时任务错误修复

parent 1c72a2e2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* @Author: ygy * @Author: ygy
* @Date: 2018-03-14 19:40:01 * @Date: 2018-03-14 19:40:01
* @Last Modified by: ygy * @Last Modified by: ygy
* @Last Modified time: 2018-03-23 18:32:48 * @Last Modified time: 2018-03-26 09:43:45
*/ */
const Koa = require('koa'); const Koa = require('koa');
const send = require('koa-send'); const send = require('koa-send');
...@@ -15,6 +15,7 @@ const templating = require('./utils/templating'); ...@@ -15,6 +15,7 @@ const templating = require('./utils/templating');
const rest = require('./utils/rest'); const rest = require('./utils/rest');
const filter = require('./filter/index'); const filter = require('./filter/index');
const task = require('./task/index'); const task = require('./task/index');
const schedule = require('node-schedule');
const app = new Koa(); const app = new Koa();
...@@ -60,12 +61,9 @@ app.use(rest.restify()); ...@@ -60,12 +61,9 @@ app.use(rest.restify());
// add controllers: // add controllers:
app.use(router()); app.use(router());
const schedule = require('node-schedule'); // start task schedule
schedule.scheduleJob({ hour: 4, minute: 0, second: 0 }, () => {
const j = schedule.scheduleJob({ hour: 4 }, function() {
console.log('执行任务开始');
task.runTiming(); task.runTiming();
console.log('执行任务结束');
}); });
app.listen(5000); app.listen(5000);
......
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