@nger/fk-upload 1.0.47 → 1.0.50
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.
@@ -37,13 +37,15 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
37
37
|
});
|
38
38
|
let total = 0;
|
39
39
|
let length = 0;
|
40
|
-
let md5 = ``;
|
41
40
|
console.log(`download ${url}`);
|
42
41
|
const sub = new rxjs_1.Subject();
|
43
42
|
sub.pipe((0, operators_1.throttleTime)(1000), (0, operators_1.switchMap)((size) => {
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
return db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { totalSize: total, size });
|
44
|
+
})).subscribe({
|
45
|
+
next: () => { },
|
46
|
+
complete: () => {
|
47
|
+
}
|
48
|
+
});
|
47
49
|
// get split size
|
48
50
|
req.on('data', (buf) => {
|
49
51
|
length += buf.length;
|
@@ -57,8 +59,7 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
57
59
|
writeStream.end();
|
58
60
|
sub.complete();
|
59
61
|
const fileMd5 = await (0, md5_file_1.default)(task.path);
|
60
|
-
|
61
|
-
console.log(`file download success ${task.filename}, check result is ${isEqual}`);
|
62
|
+
console.log(`file download success ${task.filename}: ${fileMd5}`);
|
62
63
|
const uploadTask = await this.createUploadTask(task, total, fileMd5, injector);
|
63
64
|
await manager.send(uploadTask);
|
64
65
|
complete();
|
@@ -5,8 +5,6 @@ const rabbitmq_1 = require("@nger/rabbitmq");
|
|
5
5
|
const actions_1 = require("./actions");
|
6
6
|
const typeorm_1 = require("@nger/typeorm");
|
7
7
|
const w7_1 = require("@nger/w7");
|
8
|
-
const entities_1 = require("../../entities");
|
9
|
-
const fs_extra_1 = require("fs-extra");
|
10
8
|
class EffectTask extends rabbitmq_1.Task {
|
11
9
|
constructor() {
|
12
10
|
super(actions_1.EFFECT_ACTION);
|
@@ -17,14 +15,13 @@ class EffectTask extends rabbitmq_1.Task {
|
|
17
15
|
const fail = injector.get(rabbitmq_1.FAIL);
|
18
16
|
const w7 = injector.get(w7_1.W7DataSource);
|
19
17
|
const db = injector.get(typeorm_1.Db);
|
20
|
-
await db.manager.update(
|
21
|
-
if (task.topicId) {
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
}
|
18
|
+
// await db.manager.update(FkDownloadTaskEntity, task.filename, { status: 3, uploadUrl: task.uploadUrl });
|
19
|
+
// if (task.topicId) {
|
20
|
+
// await unlink(task.path);
|
21
|
+
// await w7.manager.update(W7ChatTopicEntity, task.topicId, { thirdUrl: task.uploadUrl }).then(() => complete()).catch(() => fail())
|
22
|
+
// } else {
|
23
|
+
// complete();
|
24
|
+
// }
|
28
25
|
if (next)
|
29
26
|
await next();
|
30
27
|
}
|
@@ -159,6 +159,9 @@ let FkService = class FkService {
|
|
159
159
|
const data = uploadResult.data;
|
160
160
|
const downUrl = data.path;
|
161
161
|
if (downUrl) {
|
162
|
+
console.log({
|
163
|
+
data
|
164
|
+
});
|
162
165
|
const fullUrl = downUrl.startsWith('http') ? downUrl : `https:` + downUrl;
|
163
166
|
task.uploadUrl = fullUrl;
|
164
167
|
}
|