@nger/fk-upload 1.0.39 → 1.0.40
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.
package/dist/main.js
CHANGED
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
|
|
5
5
|
require("reflect-metadata");
|
6
6
|
require('dotenv').config();
|
7
7
|
const core_1 = require("@nger/core");
|
8
|
-
const core_2 = require("@nger/core");
|
9
8
|
const fk_upload_module_1 = require("./fk-upload.module");
|
10
9
|
const http_1 = require("@nger/http");
|
11
10
|
const typeorm_1 = require("@nger/typeorm");
|
@@ -19,7 +18,7 @@ const w7_1 = require("@nger/w7");
|
|
19
18
|
let AppModule = class AppModule {
|
20
19
|
};
|
21
20
|
AppModule = tslib_1.__decorate([
|
22
|
-
(0,
|
21
|
+
(0, core_1.Module)({
|
23
22
|
providers: [{
|
24
23
|
provide: core_1.APP_ROOT,
|
25
24
|
useValue: process.cwd()
|
@@ -24,6 +24,14 @@ let AddTaskController = class AddTaskController {
|
|
24
24
|
const loginEntity = await this.db.manager.findOne(entities_1.FkLoginEntity, { where: { w7Username: we7Username } });
|
25
25
|
if (loginEntity) {
|
26
26
|
const task = await this.taskService.createDownLoadTask(url, loginEntity.fkLoginId, 0);
|
27
|
+
const download = task.data;
|
28
|
+
const fkdownloadTask = new entities_1.FkDownloadTaskEntity();
|
29
|
+
fkdownloadTask.filename = download.filename;
|
30
|
+
fkdownloadTask.loginId = download.loginId;
|
31
|
+
fkdownloadTask.path = download.path;
|
32
|
+
fkdownloadTask.url = download.url;
|
33
|
+
fkdownloadTask.topicId = download.topicId;
|
34
|
+
await this.db.manager.save(entities_1.FkDownloadTaskEntity, fkdownloadTask);
|
27
35
|
await this.task.send(task);
|
28
36
|
}
|
29
37
|
ctx.redirect('/@nger/fk-upload/task-manage');
|
@@ -17,8 +17,8 @@ class EffectTask extends rabbitmq_1.Task {
|
|
17
17
|
const fail = injector.get(rabbitmq_1.FAIL);
|
18
18
|
const w7 = injector.get(w7_1.W7DataSource);
|
19
19
|
const db = injector.get(typeorm_1.Db);
|
20
|
+
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 3, uploadUrl: task.uploadUrl });
|
20
21
|
if (task.topicId) {
|
21
|
-
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 3, uploadUrl: task.uploadUrl });
|
22
22
|
await (0, fs_extra_1.unlink)(task.path);
|
23
23
|
await w7.manager.update(w7_1.W7ChatTopicEntity, task.topicId, { thirdUrl: task.uploadUrl }).then(() => complete()).catch(() => fail());
|
24
24
|
}
|
@@ -43,7 +43,18 @@ let TaskService = class TaskService {
|
|
43
43
|
const _url = new URL(url);
|
44
44
|
const filePath = _url.pathname;
|
45
45
|
let ext = (0, path_1.extname)(filePath);
|
46
|
-
|
46
|
+
if (ext.length < 5) {
|
47
|
+
filename += ext === '.' ? '.mp4' : ext;
|
48
|
+
}
|
49
|
+
else if (filename.indexOf('.jpg')) {
|
50
|
+
filename += '.jpg';
|
51
|
+
}
|
52
|
+
else if (filename.indexOf('.png')) {
|
53
|
+
filename += '.png';
|
54
|
+
}
|
55
|
+
else if (filename.indexOf('.mp4')) {
|
56
|
+
filename += '.mp4';
|
57
|
+
}
|
47
58
|
const root = this.injector.get(core_1.APP_ROOT);
|
48
59
|
(0, fs_extra_1.ensureDirSync)((0, path_1.join)(root, 'attachments/fk-upload'));
|
49
60
|
const path = (0, path_1.join)(root, 'attachments/fk-upload', filename);
|
package/docs.md
CHANGED