@nger/fk-upload 1.0.46 → 1.0.49
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.
@@ -41,7 +41,6 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
41
41
|
console.log(`download ${url}`);
|
42
42
|
const sub = new rxjs_1.Subject();
|
43
43
|
sub.pipe((0, operators_1.throttleTime)(1000), (0, operators_1.switchMap)((size) => {
|
44
|
-
console.log(`download ${task.filename}: ${length}`);
|
45
44
|
return db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { size });
|
46
45
|
})).subscribe();
|
47
46
|
// get split size
|
@@ -5,8 +5,6 @@ const rabbitmq_1 = require("@nger/rabbitmq");
|
|
5
5
|
const actions_1 = require("./actions");
|
6
6
|
const typeorm_1 = require("@nger/typeorm");
|
7
7
|
const w7_1 = require("@nger/w7");
|
8
|
-
const entities_1 = require("../../entities");
|
9
|
-
const fs_extra_1 = require("fs-extra");
|
10
8
|
class EffectTask extends rabbitmq_1.Task {
|
11
9
|
constructor() {
|
12
10
|
super(actions_1.EFFECT_ACTION);
|
@@ -17,14 +15,13 @@ class EffectTask extends rabbitmq_1.Task {
|
|
17
15
|
const fail = injector.get(rabbitmq_1.FAIL);
|
18
16
|
const w7 = injector.get(w7_1.W7DataSource);
|
19
17
|
const db = injector.get(typeorm_1.Db);
|
20
|
-
await db.manager.update(
|
21
|
-
if (task.topicId) {
|
22
|
-
|
23
|
-
|
24
|
-
}
|
25
|
-
|
26
|
-
|
27
|
-
}
|
18
|
+
// await db.manager.update(FkDownloadTaskEntity, task.filename, { status: 3, uploadUrl: task.uploadUrl });
|
19
|
+
// if (task.topicId) {
|
20
|
+
// await unlink(task.path);
|
21
|
+
// await w7.manager.update(W7ChatTopicEntity, task.topicId, { thirdUrl: task.uploadUrl }).then(() => complete()).catch(() => fail())
|
22
|
+
// } else {
|
23
|
+
// complete();
|
24
|
+
// }
|
28
25
|
if (next)
|
29
26
|
await next();
|
30
27
|
}
|
@@ -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
|
}
|
@@ -31,23 +31,20 @@ class ScheduleTask extends rabbitmq_1.Task {
|
|
31
31
|
const uids = users.map(user => user.uid);
|
32
32
|
const uniAccounts = await w7.manager.find(w7_1.W7UniAccountEntity, { where: { createUid: (0, typeorm_2.In)(uids) } });
|
33
33
|
const uniacids = uniAccounts.map(a => a.uniacid);
|
34
|
-
console.log(`uniacids`, uniacids);
|
35
34
|
const tasks = await db.manager.find(entities_1.FkDownloadTaskEntity, { select: ['topicId'] });
|
36
35
|
const ids = tasks.map(task => task.topicId);
|
37
|
-
console.log(`topic ids`, ids);
|
38
36
|
const date = new Date('2022-05-10');
|
39
37
|
const nowTime = Math.floor(date.getTime() / 1000);
|
40
38
|
const where = {
|
41
39
|
uniacid: (0, typeorm_2.In)(uniacids),
|
42
|
-
createTime: (0, typeorm_2.MoreThan)(nowTime)
|
43
|
-
thirdUrl: (0, typeorm_2.Not)('Null')
|
40
|
+
createTime: (0, typeorm_2.MoreThan)(nowTime)
|
44
41
|
};
|
45
42
|
if (ids && ids.length > 0) {
|
46
43
|
where.id = (0, typeorm_2.Not)((0, typeorm_2.In)(ids));
|
47
44
|
}
|
48
45
|
const topics = await w7.manager.find(w7_1.W7ChatTopicEntity, { where });
|
49
46
|
console.log(`topics`, topics.length);
|
50
|
-
topics.map(async (topic) => {
|
47
|
+
topics.filter(it => it.thirdUrl && it.thirdUrl.length > 0 && it.thirdUrl.endsWith('.mp4')).map(async (topic) => {
|
51
48
|
if (topic.thirdUrl) {
|
52
49
|
const uniacid = topic.uniacid;
|
53
50
|
const account = uniAccounts.find(a => a.uniacid === uniacid);
|