@nger/fk-upload 1.0.109 → 1.0.110
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.
@@ -17,6 +17,7 @@ let FkDownloadTaskEntity = class FkDownloadTaskEntity {
|
|
17
17
|
fileMd5;
|
18
18
|
topicId;
|
19
19
|
createDate;
|
20
|
+
isBigFile;
|
20
21
|
};
|
21
22
|
tslib_1.__decorate([
|
22
23
|
(0, typeorm_1.PrimaryColumn)(),
|
@@ -95,6 +96,12 @@ tslib_1.__decorate([
|
|
95
96
|
}),
|
96
97
|
tslib_1.__metadata("design:type", Date)
|
97
98
|
], FkDownloadTaskEntity.prototype, "createDate", void 0);
|
99
|
+
tslib_1.__decorate([
|
100
|
+
(0, typeorm_1.Column)({
|
101
|
+
default: false
|
102
|
+
}),
|
103
|
+
tslib_1.__metadata("design:type", Boolean)
|
104
|
+
], FkDownloadTaskEntity.prototype, "isBigFile", void 0);
|
98
105
|
FkDownloadTaskEntity = tslib_1.__decorate([
|
99
106
|
(0, typeorm_1.Entity)({
|
100
107
|
name: 'nger_fk_download_task'
|
@@ -64,7 +64,6 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
64
64
|
sub.complete();
|
65
65
|
const fileMd5 = await (0, md5_file_1.default)(task.path);
|
66
66
|
console.log(`file download success ${task.filename}: ${fileMd5}`);
|
67
|
-
const db = injector.get(typeorm_1.Db);
|
68
67
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { totalSize: total, fileMd5: fileMd5, status: 1, size: total });
|
69
68
|
const fk = injector.get(fk_service_1.FkService);
|
70
69
|
const shouldSize = await fk.getSize(task.url);
|
@@ -83,7 +82,7 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
83
82
|
total = Number(headers["content-length"]);
|
84
83
|
console.log(`${task.filename} total is ${total}b`);
|
85
84
|
if (total > 1024 * 1024 * 1024) {
|
86
|
-
|
85
|
+
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { isBigFile: true });
|
87
86
|
req.destroy();
|
88
87
|
await complete();
|
89
88
|
}
|
@@ -12,6 +12,7 @@ class EffectTask extends rabbitmq_1.Task {
|
|
12
12
|
super(actions_1.EFFECT_ACTION);
|
13
13
|
}
|
14
14
|
async handle(injector, next) {
|
15
|
+
const db = injector.get(typeorm_1.Db);
|
15
16
|
const task = injector.get(rabbitmq_1.DATA);
|
16
17
|
const complete = injector.get(rabbitmq_1.COMPLETE);
|
17
18
|
console.log(`effect`, task.filename);
|
@@ -21,7 +22,6 @@ class EffectTask extends rabbitmq_1.Task {
|
|
21
22
|
}
|
22
23
|
const fail = injector.get(rabbitmq_1.FAIL);
|
23
24
|
const w7 = injector.get(w7_1.W7DataSource);
|
24
|
-
const db = injector.get(typeorm_1.Db);
|
25
25
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 3 });
|
26
26
|
if (task.topicId) {
|
27
27
|
try {
|