@nger/fk-upload 1.0.184 → 1.0.187
Sign up to get free protection for your applications and to get access to all the features.
@@ -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,12 @@ 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
|
+
if (topic) {
|
108
|
+
Reflect.set(topic, 'topicName', topic.topicName);
|
109
|
+
}
|
110
|
+
}));
|
102
111
|
const count = await this.db.manager.count(entities_1.FkDownloadTaskEntity, { where });
|
103
112
|
// const downloadSize = await this.db.manager.find();
|
104
113
|
const totalPage = Math.ceil(count / psize);
|
@@ -188,6 +197,7 @@ let TaskManageController = class TaskManageController {
|
|
188
197
|
react_1.default.createElement("td", null),
|
189
198
|
react_1.default.createElement("td", null),
|
190
199
|
react_1.default.createElement("td", null, "\u65F6\u95F4"),
|
200
|
+
react_1.default.createElement("td", null, "\u8BFE\u7A0B\u6807\u9898"),
|
191
201
|
react_1.default.createElement("td", null, "\u64CD\u4F5C"))),
|
192
202
|
react_1.default.createElement("tbody", null, tasks.map((task, key) => {
|
193
203
|
const login = getLogin(task.loginId);
|
@@ -209,7 +219,8 @@ let TaskManageController = class TaskManageController {
|
|
209
219
|
react_1.default.createElement("td", null, login.username),
|
210
220
|
react_1.default.createElement("td", null, login.pass),
|
211
221
|
react_1.default.createElement("td", null, login.w7Username),
|
212
|
-
react_1.default.createElement("td", null, `${task.createDate.getMonth() + 1}月${task.createDate.
|
222
|
+
react_1.default.createElement("td", null, `${task.createDate.getMonth() + 1}月${task.createDate.getDate()}日:${task.createDate.getMinutes()}分`),
|
223
|
+
react_1.default.createElement("td", null, Reflect.get(task, 'topicName')),
|
213
224
|
react_1.default.createElement("td", null,
|
214
225
|
react_1.default.createElement("input", { type: "hidden", id: task.filename + '-copy', onChange: () => { }, value: task.uploadUrl }),
|
215
226
|
react_1.default.createElement("a", { className: "btn", target: "_blank", href: url }, "\u4E0B\u8F7D"),
|
@@ -286,6 +297,6 @@ tslib_1.__decorate([
|
|
286
297
|
], TaskManageController.prototype, "finishTask", null);
|
287
298
|
TaskManageController = tslib_1.__decorate([
|
288
299
|
(0, core_1.Controller)(`@nger/fk-upload`),
|
289
|
-
tslib_1.__metadata("design:paramtypes", [typeorm_1.Db, core_1.Config, electron_1.BrowserWindow])
|
300
|
+
tslib_1.__metadata("design:paramtypes", [typeorm_1.Db, core_1.Config, electron_1.BrowserWindow, w7_1.W7DataSource])
|
290
301
|
], TaskManageController);
|
291
302
|
exports.TaskManageController = TaskManageController;
|