12345678910111213141516171819202122 |
- 'use strict';
- const _ = require('lodash');
- const Subscription = require('egg').Subscription;
- class TaskPortal extends Subscription {
- // 通过 schedule 属性来设置定时任务的执行间隔等配置
- static get schedule() {
- // return {
- // interval: '5m',
- // type: 'all',
- // };
- }
- // // subscribe 是真正定时任务执行时被运行的函数
- async subscribe() {
- // const res = await this.ctx.curl('http://127.0.0.1:8081/api/servicetest/thousand', {
- // dataType: 'json',
- // });
- // console.log(res.data);
- await this.ctx.service.thousand.create();
- }
- }
- module.exports = TaskPortal;
|