@nger/fk-upload 1.0.48 → 1.0.51
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();
|
@@ -72,7 +73,7 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
72
73
|
}
|
73
74
|
async createUploadTask(download, total, md5, injector) {
|
74
75
|
const db = injector.get(typeorm_1.Db);
|
75
|
-
await db.manager.update(entities_1.FkDownloadTaskEntity, download.filename, { totalSize: total, status: 1, size: total });
|
76
|
+
await db.manager.update(entities_1.FkDownloadTaskEntity, download.filename, { totalSize: total, fileMd5: md5, status: 1, size: total });
|
76
77
|
const fk = injector.get(fk_service_1.FkService);
|
77
78
|
const info = await fk.getUploadInfo(download.loginId, download.filename, md5, total);
|
78
79
|
if (info) {
|
@@ -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
|
}
|