@nger/fk-upload 1.0.35 → 1.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,6 +6,7 @@ const actions_1 = require("./actions");
|
|
6
6
|
const typeorm_1 = require("@nger/typeorm");
|
7
7
|
const w7_1 = require("@nger/w7");
|
8
8
|
const entities_1 = require("../../entities");
|
9
|
+
const fs_extra_1 = require("fs-extra");
|
9
10
|
class EffectTask extends rabbitmq_1.Task {
|
10
11
|
constructor() {
|
11
12
|
super(actions_1.EFFECT_ACTION);
|
@@ -18,6 +19,7 @@ class EffectTask extends rabbitmq_1.Task {
|
|
18
19
|
const db = injector.get(typeorm_1.Db);
|
19
20
|
if (task.topicId) {
|
20
21
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 3, uploadUrl: task.uploadUrl });
|
22
|
+
await (0, fs_extra_1.unlink)(task.path);
|
21
23
|
await w7.manager.update(w7_1.W7ChatTopicEntity, task.topicId, { thirdUrl: task.uploadUrl }).then(() => complete()).catch(() => fail());
|
22
24
|
}
|
23
25
|
else {
|
@@ -4,7 +4,7 @@ import { TaskEntity } from "@nger/rabbitmq";
|
|
4
4
|
export declare class TaskService {
|
5
5
|
private injector;
|
6
6
|
constructor(injector: Injector);
|
7
|
-
createEffectTask(filename: string, uploadUrl: string, topicId: number): Promise<TaskEntity<any>>;
|
7
|
+
createEffectTask(filename: string, uploadUrl: string, topicId: number, path: string): Promise<TaskEntity<any>>;
|
8
8
|
createScheduleTask(name: string, rule: string): Promise<TaskEntity<any>>;
|
9
9
|
createDownLoadTask(url: string, loginId: number, topicId: number): Promise<TaskEntity<IDownloadTask>>;
|
10
10
|
}
|
@@ -25,11 +25,12 @@ let TaskService = class TaskService {
|
|
25
25
|
constructor(injector) {
|
26
26
|
this.injector = injector;
|
27
27
|
}
|
28
|
-
async createEffectTask(filename, uploadUrl, topicId) {
|
28
|
+
async createEffectTask(filename, uploadUrl, topicId, path) {
|
29
29
|
const effect = {
|
30
30
|
filename,
|
31
31
|
uploadUrl,
|
32
|
-
topicId
|
32
|
+
topicId,
|
33
|
+
path
|
33
34
|
};
|
34
35
|
const task = new rabbitmq_1.TaskEntity();
|
35
36
|
task.topic = actions_1.EFFECT_ACTION;
|
@@ -22,7 +22,7 @@ class UploadTask extends rabbitmq_1.Task {
|
|
22
22
|
await fk.startUploadFile(task).then(async (res) => {
|
23
23
|
// create effect task
|
24
24
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 2, uploadUrl: task.uploadUrl, uploadSize: task.total, uploadStatus: 1 });
|
25
|
-
const effectTask = await taskService.createEffectTask(task.filename, task.uploadUrl, task.topicId);
|
25
|
+
const effectTask = await taskService.createEffectTask(task.filename, task.uploadUrl, task.topicId, task.path);
|
26
26
|
return manager.send(effectTask).then(() => complete()).catch(() => fail());
|
27
27
|
}).catch(() => fail());
|
28
28
|
if (next)
|