zs 1 year ago
parent
commit
63d6816eb1
2 changed files with 0 additions and 21 deletions
  1. 0 2
      package.json
  2. 0 19
      src/schedule/hello.ts

+ 0 - 2
package.json

@@ -22,7 +22,6 @@
     "amqp-connection-manager": "^4.1.13",
     "amqplib": "^0.10.3",
     "compressing": "^1.9.0",
-    "egg": "^3.16.0",
     "exceljs": "^4.3.0",
     "free-midway-component": "^1.0.35",
     "midway-schedule": "^2.15.0",
@@ -32,7 +31,6 @@
   },
   "devDependencies": {
     "@midwayjs/cli": "^2.0.0",
-    "@midwayjs/egg-ts-helper": "^1.2.1",
     "@midwayjs/mock": "^3.0.0",
     "@types/amqplib": "^0.10.1",
     "@types/jest": "^29.2.0",

+ 0 - 19
src/schedule/hello.ts

@@ -1,19 +0,0 @@
-// src/schedule/hello.ts
-import { Provide, Inject, Schedule, CommonSchedule } from '@midwayjs/decorator';
-import { Context } from '@midwayjs/koa';
-
-@Provide()
-@Schedule({
-  cron: '*/5 * * * * * *',
-  type: 'worker', // 指定某一个 worker 执行
-})
-export class HelloCron implements CommonSchedule {
-  @Inject()
-  ctx: Context;
-
-  // 定时执行的具体任务
-  async exec() {
-    this.ctx.logger.error('定时任务');
-    console.log('定时任务');
-  }
-}