@nger/fk-upload 1.0.184 → 1.0.185
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.
@@ -3,11 +3,13 @@ import { Config } from '@nger/core';
|
|
3
3
|
import { Db } from '@nger/typeorm';
|
4
4
|
import { Context } from 'koa';
|
5
5
|
import { BrowserWindow } from 'electron';
|
6
|
+
import { W7DataSource } from '@nger/w7';
|
6
7
|
export declare class TaskManageController {
|
7
8
|
private db;
|
8
9
|
private config;
|
9
10
|
private win;
|
10
|
-
|
11
|
+
private w7;
|
12
|
+
constructor(db: Db, config: Config, win: BrowserWindow, w7: W7DataSource);
|
11
13
|
toUrl(query: any): string;
|
12
14
|
createPages(total: number, query: any, page: number): {
|
13
15
|
index: number;
|
@@ -25,14 +25,17 @@ function getStatusTitle(status) {
|
|
25
25
|
}
|
26
26
|
}
|
27
27
|
const electron_1 = require("electron");
|
28
|
+
const w7_1 = require("@nger/w7");
|
28
29
|
let TaskManageController = class TaskManageController {
|
29
30
|
db;
|
30
31
|
config;
|
31
32
|
win;
|
32
|
-
|
33
|
+
w7;
|
34
|
+
constructor(db, config, win, w7) {
|
33
35
|
this.db = db;
|
34
36
|
this.config = config;
|
35
37
|
this.win = win;
|
38
|
+
this.w7 = w7;
|
36
39
|
}
|
37
40
|
toUrl(query) {
|
38
41
|
return Object.keys(query).map(key => `${key}=${decodeURIComponent(query[key])}`).join('&');
|
@@ -99,6 +102,10 @@ let TaskManageController = class TaskManageController {
|
|
99
102
|
const take = psize;
|
100
103
|
const skip = (page - 1) * psize;
|
101
104
|
const tasks = await this.db.manager.find(entities_1.FkDownloadTaskEntity, { where, order: { createDate: "DESC" }, take, skip });
|
105
|
+
await Promise.all(tasks.map(async (task) => {
|
106
|
+
const topic = await this.w7.manager.findOne(w7_1.W7ChatTopicEntity, { where: { id: task.topicId } });
|
107
|
+
Reflect.set(topic, 'topicName', topic.topicName);
|
108
|
+
}));
|
102
109
|
const count = await this.db.manager.count(entities_1.FkDownloadTaskEntity, { where });
|
103
110
|
// const downloadSize = await this.db.manager.find();
|
104
111
|
const totalPage = Math.ceil(count / psize);
|
@@ -188,6 +195,7 @@ let TaskManageController = class TaskManageController {
|
|
188
195
|
react_1.default.createElement("td", null),
|
189
196
|
react_1.default.createElement("td", null),
|
190
197
|
react_1.default.createElement("td", null, "\u65F6\u95F4"),
|
198
|
+
react_1.default.createElement("td", null, "\u8BFE\u7A0B\u6807\u9898"),
|
191
199
|
react_1.default.createElement("td", null, "\u64CD\u4F5C"))),
|
192
200
|
react_1.default.createElement("tbody", null, tasks.map((task, key) => {
|
193
201
|
const login = getLogin(task.loginId);
|
@@ -210,6 +218,7 @@ let TaskManageController = class TaskManageController {
|
|
210
218
|
react_1.default.createElement("td", null, login.pass),
|
211
219
|
react_1.default.createElement("td", null, login.w7Username),
|
212
220
|
react_1.default.createElement("td", null, `${task.createDate.getMonth() + 1}月${task.createDate.getDay()}日:${task.createDate.getMinutes()}分`),
|
221
|
+
react_1.default.createElement("td", null, Reflect.get(task, 'topicName')),
|
213
222
|
react_1.default.createElement("td", null,
|
214
223
|
react_1.default.createElement("input", { type: "hidden", id: task.filename + '-copy', onChange: () => { }, value: task.uploadUrl }),
|
215
224
|
react_1.default.createElement("a", { className: "btn", target: "_blank", href: url }, "\u4E0B\u8F7D"),
|
@@ -286,6 +295,6 @@ tslib_1.__decorate([
|
|
286
295
|
], TaskManageController.prototype, "finishTask", null);
|
287
296
|
TaskManageController = tslib_1.__decorate([
|
288
297
|
(0, core_1.Controller)(`@nger/fk-upload`),
|
289
|
-
tslib_1.__metadata("design:paramtypes", [typeorm_1.Db, core_1.Config, electron_1.BrowserWindow])
|
298
|
+
tslib_1.__metadata("design:paramtypes", [typeorm_1.Db, core_1.Config, electron_1.BrowserWindow, w7_1.W7DataSource])
|
290
299
|
], TaskManageController);
|
291
300
|
exports.TaskManageController = TaskManageController;
|