|
@@ -1,28 +1,29 @@
|
|
-import { Processor, IProcessor } from '@midwayjs/bull';
|
|
|
|
-import { FORMAT, Inject } from '@midwayjs/core';
|
|
|
|
-import { FileService } from '../service/File.service';
|
|
|
|
|
|
+// 禁用bull
|
|
|
|
+// import { Processor, IProcessor } from '@midwayjs/bull';
|
|
|
|
+// import { FORMAT, Inject } from '@midwayjs/core';
|
|
|
|
+// import { FileService } from '../service/File.service';
|
|
|
|
|
|
-/**
|
|
|
|
- * 定时任务队列,处理未使用的文件
|
|
|
|
- */
|
|
|
|
-@Processor('FileClear', {
|
|
|
|
- repeat: {
|
|
|
|
- cron: FORMAT.CRONTAB.EVERY_DAY,
|
|
|
|
- },
|
|
|
|
-})
|
|
|
|
-export class FileClearProcessor implements IProcessor {
|
|
|
|
- @Inject()
|
|
|
|
- fileService: FileService;
|
|
|
|
|
|
+// /**
|
|
|
|
+// * 定时任务队列,处理未使用的文件
|
|
|
|
+// */
|
|
|
|
+// @Processor('FileClear', {
|
|
|
|
+// repeat: {
|
|
|
|
+// cron: FORMAT.CRONTAB.EVERY_DAY,
|
|
|
|
+// },
|
|
|
|
+// })
|
|
|
|
+// export class FileClearProcessor implements IProcessor {
|
|
|
|
+// @Inject()
|
|
|
|
+// fileService: FileService;
|
|
|
|
|
|
- async execute() {
|
|
|
|
- try {
|
|
|
|
- // 先重写文件地址表
|
|
|
|
- const modelResults = this.fileService.scanModelHaveFile();
|
|
|
|
- await this.fileService.setFileUriFromDefaultDataBase(modelResults);
|
|
|
|
- // 再清除未使用的上传文件
|
|
|
|
- await this.fileService.deleteNoUseFile();
|
|
|
|
- } catch (error) {
|
|
|
|
- console.error(error);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// async execute() {
|
|
|
|
+// try {
|
|
|
|
+// // 先重写文件地址表
|
|
|
|
+// const modelResults = this.fileService.scanModelHaveFile();
|
|
|
|
+// await this.fileService.setFileUriFromDefaultDataBase(modelResults);
|
|
|
|
+// // 再清除未使用的上传文件
|
|
|
|
+// await this.fileService.deleteNoUseFile();
|
|
|
|
+// } catch (error) {
|
|
|
|
+// console.error(error);
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// }
|