component-shipinlv 2.1.1 → 2.1.3

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.
@@ -1,6 +1,4 @@
1
- /// <reference types="node" />
2
1
  declare class ActiveAccountModeTask {
3
- timer: NodeJS.Timeout;
4
2
  loopSecond: number;
5
3
  modeSetting: ActiveAccountModeSetting.Detail;
6
4
  env: Global.Env | undefined;
@@ -10,6 +8,7 @@ declare class ActiveAccountModeTask {
10
8
  };
11
9
  constructor(env?: Global.Env);
12
10
  destroy(): void;
11
+ onLoop(): Promise<void>;
13
12
  loop(): Promise<void>;
14
13
  makePublishTask(videoAccountId: number, needTaskCount: number, dayIndex: number): Promise<unknown>;
15
14
  postTask(videoAccountId: number, videoList: string[], topicList: string[], dayIndex: number): Promise<unknown>;
@@ -1,6 +1,6 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
- import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
2
  import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
4
4
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
5
5
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
6
6
  import _createClass from "@babel/runtime/helpers/esm/createClass";
@@ -18,7 +18,6 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
18
18
  function ActiveAccountModeTask(env) {
19
19
  var _this = this;
20
20
  _classCallCheck(this, ActiveAccountModeTask);
21
- _defineProperty(this, "timer", void 0);
22
21
  _defineProperty(this, "loopSecond", 3 * 60);
23
22
  _defineProperty(this, "modeSetting", {
24
23
  dayTimeHourList: [],
@@ -32,64 +31,94 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
32
31
  _defineProperty(this, "accountList", []);
33
32
  _defineProperty(this, "planDict", {});
34
33
  this.env = env;
35
- this.timer = setInterval(function () {
34
+ // this.timer = setInterval(() => {
35
+ // this.loop();
36
+ // }, this.loopSecond * 1e3 )
37
+ //
38
+ setTimeout(function () {
36
39
  _this.loop();
37
- }, this.loopSecond * 1e3);
40
+ }, 5e3);
38
41
  }
39
42
  _createClass(ActiveAccountModeTask, [{
40
43
  key: "destroy",
41
44
  value: function destroy() {}
42
45
  }, {
43
- key: "loop",
46
+ key: "onLoop",
44
47
  value: function () {
45
- var _loop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
46
- var setting, accountList, dayIndex, day, startTime, endTime, list, _iterator, _step, items, _iterator2, _step2, _this$planDict$accoun, accountItem, count;
48
+ var _onLoop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
47
49
  return _regeneratorRuntime().wrap(function _callee$(_context) {
48
50
  while (1) switch (_context.prev = _context.next) {
49
51
  case 0:
50
52
  _context.next = 2;
53
+ return sleep(this.loopSecond * 1e3);
54
+ case 2:
55
+ this.loop();
56
+ case 3:
57
+ case "end":
58
+ return _context.stop();
59
+ }
60
+ }, _callee, this);
61
+ }));
62
+ function onLoop() {
63
+ return _onLoop.apply(this, arguments);
64
+ }
65
+ return onLoop;
66
+ }()
67
+ }, {
68
+ key: "loop",
69
+ value: function () {
70
+ var _loop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
71
+ var setting, accountList, dayIndex, day, startTime, endTime, list, _iterator, _step, items, _iterator2, _step2, _this$planDict$accoun, accountItem, count;
72
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
73
+ while (1) switch (_context2.prev = _context2.next) {
74
+ case 0:
75
+ _context2.next = 2;
51
76
  return this.getSetting().catch(function (err) {
52
77
  toastError('获取设置错误:' + (err === null || err === void 0 ? void 0 : err.message));
53
78
  });
54
79
  case 2:
55
- setting = _context.sent;
80
+ setting = _context2.sent;
56
81
  if (setting) {
57
- _context.next = 5;
82
+ _context2.next = 6;
58
83
  break;
59
84
  }
60
- return _context.abrupt("return");
61
- case 5:
85
+ this.onLoop();
86
+ return _context2.abrupt("return");
87
+ case 6:
62
88
  this.modeSetting = setting;
63
89
  if (setting.enabled) {
64
- _context.next = 9;
90
+ _context2.next = 11;
65
91
  break;
66
92
  }
67
93
  console.log('setting disabled!');
68
- return _context.abrupt("return");
69
- case 9:
70
- _context.next = 11;
94
+ this.onLoop();
95
+ return _context2.abrupt("return");
96
+ case 11:
97
+ _context2.next = 13;
71
98
  return this.getAccountList().catch(function (err) {
72
99
  toastError('获取视频账户错误:' + (err === null || err === void 0 ? void 0 : err.message));
73
100
  });
74
- case 11:
75
- accountList = _context.sent;
101
+ case 13:
102
+ accountList = _context2.sent;
76
103
  if (accountList) {
77
- _context.next = 14;
104
+ _context2.next = 17;
78
105
  break;
79
106
  }
80
- return _context.abrupt("return");
81
- case 14:
107
+ this.onLoop();
108
+ return _context2.abrupt("return");
109
+ case 17:
82
110
  this.accountList = accountList.list;
83
111
  if (!(this.accountList.length === 0)) {
84
- _context.next = 17;
112
+ _context2.next = 21;
85
113
  break;
86
114
  }
87
- return _context.abrupt("return");
88
- case 17:
115
+ this.onLoop();
116
+ return _context2.abrupt("return");
117
+ case 21:
89
118
  dayIndex = 0;
90
- case 18:
119
+ case 22:
91
120
  if (!(dayIndex < setting.publishMaxDay)) {
92
- _context.next = 65;
121
+ _context2.next = 69;
93
122
  break;
94
123
  }
95
124
  console.log('publishMaxDay:', dayIndex);
@@ -99,21 +128,21 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
99
128
  console.log("startTime:", dayIndex, new Date(startTime * 1000), new Date(endTime * 1000));
100
129
 
101
130
  // 获取用户列表;
102
- _context.next = 26;
131
+ _context2.next = 30;
103
132
  return this.getTaskPlanStatisticList(startTime, endTime).catch(function (err) {
104
133
  toastError('获取账户列表失败:' + (err === null || err === void 0 ? void 0 : err.message));
105
134
  });
106
- case 26:
107
- list = _context.sent;
135
+ case 30:
136
+ list = _context2.sent;
108
137
  if (list) {
109
- _context.next = 31;
138
+ _context2.next = 35;
110
139
  break;
111
140
  }
112
- _context.next = 30;
141
+ _context2.next = 34;
113
142
  return sleep(20e3);
114
- case 30:
115
- return _context.abrupt("continue", 62);
116
- case 31:
143
+ case 34:
144
+ return _context2.abrupt("continue", 66);
145
+ case 35:
117
146
  // 把发布过的,做一个字段
118
147
  this.planDict = {};
119
148
  _iterator = _createForOfIteratorHelper(list);
@@ -133,64 +162,66 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
133
162
  _iterator.f();
134
163
  }
135
164
  _iterator2 = _createForOfIteratorHelper(this.accountList);
136
- _context.prev = 35;
165
+ _context2.prev = 39;
137
166
  _iterator2.s();
138
- case 37:
167
+ case 41:
139
168
  if ((_step2 = _iterator2.n()).done) {
140
- _context.next = 54;
169
+ _context2.next = 58;
141
170
  break;
142
171
  }
143
172
  accountItem = _step2.value;
144
173
  count = ((_this$planDict$accoun = this.planDict[accountItem.id]) === null || _this$planDict$accoun === void 0 ? void 0 : _this$planDict$accoun.length) || 0; // 需要指定路径
145
174
  if (accountItem.videoFromFolder) {
146
- _context.next = 43;
175
+ _context2.next = 47;
147
176
  break;
148
177
  }
149
178
  console.log('no videoFromFolder :', accountItem.nickname);
150
- return _context.abrupt("continue", 52);
151
- case 43:
179
+ return _context2.abrupt("continue", 56);
180
+ case 47:
152
181
  // 删除 此账户下面,所有已经发布的视频
153
182
  this.checkDelFile(accountItem.id, accountItem.videoFromFolder);
154
183
  if (!(count >= setting.dayPublishMaxAmount)) {
155
- _context.next = 47;
184
+ _context2.next = 51;
156
185
  break;
157
186
  }
158
187
  console.log('count 2:', count, setting.dayPublishMaxAmount);
159
- return _context.abrupt("continue", 52);
160
- case 47:
188
+ return _context2.abrupt("continue", 56);
189
+ case 51:
161
190
  console.log('makePublishTask in:', accountItem.id, setting.dayPublishMaxAmount - count, dayIndex);
162
191
 
163
192
  // 生成任务
164
- _context.next = 50;
193
+ _context2.next = 54;
165
194
  return this.makePublishTask(accountItem.id, setting.dayPublishMaxAmount - count, dayIndex).catch(function (err) {
166
195
  console.log('makePublishTask err:', err);
167
196
  });
168
- case 50:
169
- _context.next = 52;
197
+ case 54:
198
+ _context2.next = 56;
170
199
  return sleep(3e3);
171
- case 52:
172
- _context.next = 37;
200
+ case 56:
201
+ _context2.next = 41;
173
202
  break;
174
- case 54:
175
- _context.next = 59;
203
+ case 58:
204
+ _context2.next = 63;
176
205
  break;
177
- case 56:
178
- _context.prev = 56;
179
- _context.t0 = _context["catch"](35);
180
- _iterator2.e(_context.t0);
181
- case 59:
182
- _context.prev = 59;
206
+ case 60:
207
+ _context2.prev = 60;
208
+ _context2.t0 = _context2["catch"](39);
209
+ _iterator2.e(_context2.t0);
210
+ case 63:
211
+ _context2.prev = 63;
183
212
  _iterator2.f();
184
- return _context.finish(59);
185
- case 62:
213
+ return _context2.finish(63);
214
+ case 66:
186
215
  dayIndex++;
187
- _context.next = 18;
216
+ _context2.next = 22;
188
217
  break;
189
- case 65:
218
+ case 69:
219
+ this.onLoop();
220
+ case 70:
190
221
  case "end":
191
- return _context.stop();
222
+ return _context2.stop();
192
223
  }
193
- }, _callee, this, [[35, 56, 59, 62]]);
224
+ }, _callee2, this, [[39, 60, 63, 66]]);
194
225
  }));
195
226
  function loop() {
196
227
  return _loop.apply(this, arguments);
@@ -200,11 +231,11 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
200
231
  }, {
201
232
  key: "makePublishTask",
202
233
  value: function () {
203
- var _makePublishTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(videoAccountId, needTaskCount, dayIndex) {
234
+ var _makePublishTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(videoAccountId, needTaskCount, dayIndex) {
204
235
  var _this$accountList$fil;
205
236
  var videoFromFolder, fileListInfo;
206
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
207
- while (1) switch (_context2.prev = _context2.next) {
237
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
238
+ while (1) switch (_context3.prev = _context3.next) {
208
239
  case 0:
209
240
  // 先不管 每天做了一部分的,假设 每次都是 做完整
210
241
  // 到这里来,肯定没做够
@@ -212,29 +243,29 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
212
243
  return item.id;
213
244
  })) === null || _this$accountList$fil === void 0 || (_this$accountList$fil = _this$accountList$fil[0]) === null || _this$accountList$fil === void 0 ? void 0 : _this$accountList$fil.videoFromFolder;
214
245
  if (videoFromFolder) {
215
- _context2.next = 4;
246
+ _context3.next = 4;
216
247
  break;
217
248
  }
218
249
  console.log('没有设置 videoFromFolder,跳过:', videoAccountId);
219
- return _context2.abrupt("return");
250
+ return _context3.abrupt("return");
220
251
  case 4:
221
- _context2.next = 6;
252
+ _context3.next = 6;
222
253
  return this.getFileList(videoAccountId, needTaskCount, videoFromFolder).catch(function (err) {});
223
254
  case 6:
224
- fileListInfo = _context2.sent;
255
+ fileListInfo = _context3.sent;
225
256
  if (fileListInfo) {
226
- _context2.next = 10;
257
+ _context3.next = 10;
227
258
  break;
228
259
  }
229
260
  console.log('no fileListInfo :', videoAccountId, needTaskCount, dayIndex);
230
- return _context2.abrupt("return");
261
+ return _context3.abrupt("return");
231
262
  case 10:
232
- return _context2.abrupt("return", this.postTask(videoAccountId, fileListInfo.videoList || [], fileListInfo.topicList || [], dayIndex));
263
+ return _context3.abrupt("return", this.postTask(videoAccountId, fileListInfo.videoList || [], fileListInfo.topicList || [], dayIndex));
233
264
  case 11:
234
265
  case "end":
235
- return _context2.stop();
266
+ return _context3.stop();
236
267
  }
237
- }, _callee2, this);
268
+ }, _callee3, this);
238
269
  }));
239
270
  function makePublishTask(_x, _x2, _x3) {
240
271
  return _makePublishTask.apply(this, arguments);
@@ -244,18 +275,18 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
244
275
  }, {
245
276
  key: "postTask",
246
277
  value: function () {
247
- var _postTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(videoAccountId, videoList, topicList, dayIndex) {
278
+ var _postTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(videoAccountId, videoList, topicList, dayIndex) {
248
279
  var _this2 = this;
249
280
  var dayStartTime, _this$modeSetting, dayPublishMaxAmount, dayTimeHourList, timeAreaRandOffsetPercent, oneVideoByMinute, publishTimeList, i, hourIndex, dayHour, hourMinute, stepTime, stepOffsetMinute;
250
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
251
- while (1) switch (_context4.prev = _context4.next) {
281
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
282
+ while (1) switch (_context5.prev = _context5.next) {
252
283
  case 0:
253
284
  if (!(((videoList === null || videoList === void 0 ? void 0 : videoList.length) || 0) <= 0)) {
254
- _context4.next = 3;
285
+ _context5.next = 3;
255
286
  break;
256
287
  }
257
288
  console.log('no videoList :', videoAccountId);
258
- return _context4.abrupt("return");
289
+ return _context5.abrupt("return");
259
290
  case 3:
260
291
  dayStartTime = dayjs().startOf('day').valueOf() + dayIndex * 86400e3; // 计算发视频间隔;
261
292
  // const planList = this.planDict[ videoAccountId ];
@@ -263,11 +294,11 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
263
294
  // return ;
264
295
  // }
265
296
  if (!(videoList.length == 0)) {
266
- _context4.next = 7;
297
+ _context5.next = 7;
267
298
  break;
268
299
  }
269
300
  console.log('postTask 没视频');
270
- return _context4.abrupt("return");
301
+ return _context5.abrupt("return");
271
302
  case 7:
272
303
  _this$modeSetting = this.modeSetting, dayPublishMaxAmount = _this$modeSetting.dayPublishMaxAmount, dayTimeHourList = _this$modeSetting.dayTimeHourList, timeAreaRandOffsetPercent = _this$modeSetting.timeAreaRandOffsetPercent;
273
304
  oneVideoByMinute = dayTimeHourList.length * 60 / dayPublishMaxAmount;
@@ -276,59 +307,59 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
276
307
  i = 0;
277
308
  case 12:
278
309
  if (!(i < dayPublishMaxAmount)) {
279
- _context4.next = 30;
310
+ _context5.next = 29;
280
311
  break;
281
312
  }
282
313
  if (!(i < dayPublishMaxAmount - videoList.length)) {
283
- _context4.next = 16;
314
+ _context5.next = 16;
284
315
  break;
285
316
  }
286
317
  console.log('for dayPublishMaxAmount :', i, dayPublishMaxAmount, videoList);
287
- return _context4.abrupt("continue", 27);
318
+ return _context5.abrupt("continue", 26);
288
319
  case 16:
289
320
  // 到多少分钟了
290
321
  hourIndex = Math.floor(i * oneVideoByMinute / 60);
291
322
  dayHour = parseInt(dayTimeHourList[hourIndex]);
292
323
  console.log('dayPublishMaxAmount 2:', i, hourIndex, dayHour);
293
324
  if (dayHour) {
294
- _context4.next = 22;
325
+ _context5.next = 22;
295
326
  break;
296
327
  }
297
328
  console.log('postTask not dayHour:', i, hourIndex, oneVideoByMinute);
298
- return _context4.abrupt("continue", 27);
329
+ return _context5.abrupt("continue", 26);
299
330
  case 22:
300
331
  hourMinute = i * oneVideoByMinute % 60;
301
332
  stepTime = dayStartTime + dayHour * 3600e3 + hourMinute * 60e3; // const stepMin = stepTime - 3600e3 * 0.01 * timeAreaRandOffsetPercent;
302
333
  stepOffsetMinute = oneVideoByMinute * 0.01 * Tool.math.randInt(0, timeAreaRandOffsetPercent); // 偏移量, 不能超过 30分钟
303
- if (stepOffsetMinute > 30) {
304
- stepOffsetMinute = 30;
305
- }
334
+ // if( stepOffsetMinute > 30 ){
335
+ // stepOffsetMinute = 30
336
+ // }
306
337
  publishTimeList.push(stepTime + stepOffsetMinute * 60e3);
307
- case 27:
338
+ case 26:
308
339
  i++;
309
- _context4.next = 12;
340
+ _context5.next = 12;
310
341
  break;
311
- case 30:
342
+ case 29:
312
343
  if (!(publishTimeList.length == 0)) {
313
- _context4.next = 33;
344
+ _context5.next = 32;
314
345
  break;
315
346
  }
316
347
  console.log('publishTimeList empty!');
317
- return _context4.abrupt("return");
318
- case 33:
319
- return _context4.abrupt("return", new Promise( /*#__PURE__*/function () {
320
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(resolve) {
348
+ return _context5.abrupt("return");
349
+ case 32:
350
+ return _context5.abrupt("return", new Promise( /*#__PURE__*/function () {
351
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(resolve) {
321
352
  var videoIndex, _iterator3, _step3, videoPath, introduction, startTime, newVideoPath, publishResult;
322
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
323
- while (1) switch (_context3.prev = _context3.next) {
353
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
354
+ while (1) switch (_context4.prev = _context4.next) {
324
355
  case 0:
325
356
  videoIndex = -1;
326
357
  _iterator3 = _createForOfIteratorHelper(videoList);
327
- _context3.prev = 2;
358
+ _context4.prev = 2;
328
359
  _iterator3.s();
329
360
  case 4:
330
361
  if ((_step3 = _iterator3.n()).done) {
331
- _context3.next = 28;
362
+ _context4.next = 28;
332
363
  break;
333
364
  }
334
365
  videoPath = _step3.value;
@@ -338,35 +369,35 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
338
369
  }).join(' ');
339
370
  startTime = publishTimeList[videoIndex];
340
371
  if (startTime) {
341
- _context3.next = 12;
372
+ _context4.next = 12;
342
373
  break;
343
374
  }
344
375
  console.log('视频没有匹配到 发布时间:', videoIndex, videoList, publishTimeList);
345
- return _context3.abrupt("continue", 26);
376
+ return _context4.abrupt("continue", 26);
346
377
  case 12:
347
- if (!(startTime <= Date.now())) {
348
- _context3.next = 16;
378
+ if (!(startTime + 86400e3 * 2 <= Date.now())) {
379
+ _context4.next = 16;
349
380
  break;
350
381
  }
351
382
  // 抛弃
352
383
 
353
384
  console.log('已经过了时间了 0。。。', dayIndex, videoAccountId);
354
385
  console.log('已经过了时间了 1。。。', videoIndex, videoList, publishTimeList);
355
- return _context3.abrupt("continue", 26);
386
+ return _context4.abrupt("continue", 26);
356
387
  case 16:
357
- _context3.next = 18;
388
+ _context4.next = 18;
358
389
  return _this2.videoRename(videoPath).catch(function (err) {
359
390
  // reject( err );
360
391
  });
361
392
  case 18:
362
- newVideoPath = _context3.sent;
393
+ newVideoPath = _context4.sent;
363
394
  if (newVideoPath) {
364
- _context3.next = 21;
395
+ _context4.next = 21;
365
396
  break;
366
397
  }
367
- return _context3.abrupt("continue", 26);
398
+ return _context4.abrupt("continue", 26);
368
399
  case 21:
369
- _context3.next = 23;
400
+ _context4.next = 23;
370
401
  return VideoPublishController.taskCreate({
371
402
  "videoFrom": "local",
372
403
  "taskFromProductType": "",
@@ -400,40 +431,40 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
400
431
  // reject( err );
401
432
  });
402
433
  case 23:
403
- publishResult = _context3.sent;
404
- _context3.next = 26;
434
+ publishResult = _context4.sent;
435
+ _context4.next = 26;
405
436
  return sleep(3e3);
406
437
  case 26:
407
- _context3.next = 4;
438
+ _context4.next = 4;
408
439
  break;
409
440
  case 28:
410
- _context3.next = 33;
441
+ _context4.next = 33;
411
442
  break;
412
443
  case 30:
413
- _context3.prev = 30;
414
- _context3.t0 = _context3["catch"](2);
415
- _iterator3.e(_context3.t0);
444
+ _context4.prev = 30;
445
+ _context4.t0 = _context4["catch"](2);
446
+ _iterator3.e(_context4.t0);
416
447
  case 33:
417
- _context3.prev = 33;
448
+ _context4.prev = 33;
418
449
  _iterator3.f();
419
- return _context3.finish(33);
450
+ return _context4.finish(33);
420
451
  case 36:
421
452
  resolve(true);
422
453
  case 37:
423
454
  case "end":
424
- return _context3.stop();
455
+ return _context4.stop();
425
456
  }
426
- }, _callee3, null, [[2, 30, 33, 36]]);
457
+ }, _callee4, null, [[2, 30, 33, 36]]);
427
458
  }));
428
459
  return function (_x8) {
429
460
  return _ref.apply(this, arguments);
430
461
  };
431
462
  }()));
432
- case 34:
463
+ case 33:
433
464
  case "end":
434
- return _context4.stop();
465
+ return _context5.stop();
435
466
  }
436
- }, _callee4, this);
467
+ }, _callee5, this);
437
468
  }));
438
469
  function postTask(_x4, _x5, _x6, _x7) {
439
470
  return _postTask.apply(this, arguments);
@@ -443,18 +474,18 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
443
474
  }, {
444
475
  key: "getSetting",
445
476
  value: function () {
446
- var _getSetting = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
447
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
448
- while (1) switch (_context5.prev = _context5.next) {
477
+ var _getSetting = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
478
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
479
+ while (1) switch (_context6.prev = _context6.next) {
449
480
  case 0:
450
- return _context5.abrupt("return", ActiveAccountModeSettingController.detail({}, {
481
+ return _context6.abrupt("return", ActiveAccountModeSettingController.detail({}, {
451
482
  env: this.env
452
483
  }));
453
484
  case 1:
454
485
  case "end":
455
- return _context5.stop();
486
+ return _context6.stop();
456
487
  }
457
- }, _callee5, this);
488
+ }, _callee6, this);
458
489
  }));
459
490
  function getSetting() {
460
491
  return _getSetting.apply(this, arguments);
@@ -464,25 +495,25 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
464
495
  }, {
465
496
  key: "getTopicList",
466
497
  value: function () {
467
- var _getTopicList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(dir) {
498
+ var _getTopicList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(dir) {
468
499
  var _window$getBridge;
469
500
  var text, list, topicList;
470
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
471
- while (1) switch (_context6.prev = _context6.next) {
501
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
502
+ while (1) switch (_context7.prev = _context7.next) {
472
503
  case 0:
473
- _context6.next = 2;
504
+ _context7.next = 2;
474
505
  return (_window$getBridge = window.getBridge()) === null || _window$getBridge === void 0 ? void 0 : _window$getBridge.getFileText("".concat(dir, "/\u8BDD\u9898.txt")).catch(function (err) {
475
506
  console.log('getTopicList err:', err);
476
507
  return '';
477
508
  });
478
509
  case 2:
479
- text = _context6.sent;
510
+ text = _context7.sent;
480
511
  if (text) {
481
- _context6.next = 6;
512
+ _context7.next = 6;
482
513
  break;
483
514
  }
484
515
  console.log('getTopicList empty:', dir);
485
- return _context6.abrupt("return", []);
516
+ return _context7.abrupt("return", []);
486
517
  case 6:
487
518
  list = text.split(/[\s\n#]/g) || [];
488
519
  topicList = [];
@@ -492,12 +523,12 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
492
523
  }
493
524
  topicList.push(topic);
494
525
  });
495
- return _context6.abrupt("return", topicList);
526
+ return _context7.abrupt("return", topicList);
496
527
  case 10:
497
528
  case "end":
498
- return _context6.stop();
529
+ return _context7.stop();
499
530
  }
500
- }, _callee6);
531
+ }, _callee7);
501
532
  }));
502
533
  function getTopicList(_x9) {
503
534
  return _getTopicList.apply(this, arguments);
@@ -507,11 +538,11 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
507
538
  }, {
508
539
  key: "getAccountList",
509
540
  value: function () {
510
- var _getAccountList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
511
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
512
- while (1) switch (_context7.prev = _context7.next) {
541
+ var _getAccountList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
542
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
543
+ while (1) switch (_context8.prev = _context8.next) {
513
544
  case 0:
514
- return _context7.abrupt("return", VideoPublishVideoAccountController.list({
545
+ return _context8.abrupt("return", VideoPublishVideoAccountController.list({
515
546
  current: 1,
516
547
  pageSize: 100
517
548
  }, {
@@ -519,9 +550,9 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
519
550
  }));
520
551
  case 1:
521
552
  case "end":
522
- return _context7.stop();
553
+ return _context8.stop();
523
554
  }
524
- }, _callee7, this);
555
+ }, _callee8, this);
525
556
  }));
526
557
  function getAccountList() {
527
558
  return _getAccountList.apply(this, arguments);
@@ -531,11 +562,11 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
531
562
  }, {
532
563
  key: "getTaskPlanStatisticList",
533
564
  value: function () {
534
- var _getTaskPlanStatisticList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(startTime, endTime) {
535
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
536
- while (1) switch (_context8.prev = _context8.next) {
565
+ var _getTaskPlanStatisticList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(startTime, endTime) {
566
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
567
+ while (1) switch (_context9.prev = _context9.next) {
537
568
  case 0:
538
- return _context8.abrupt("return", PublishTaskPlanStatisticController.list({
569
+ return _context9.abrupt("return", PublishTaskPlanStatisticController.list({
539
570
  productType: 'active-account-mode',
540
571
  platform: 'douyin',
541
572
  startTime: startTime,
@@ -545,9 +576,9 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
545
576
  }));
546
577
  case 1:
547
578
  case "end":
548
- return _context8.stop();
579
+ return _context9.stop();
549
580
  }
550
- }, _callee8, this);
581
+ }, _callee9, this);
551
582
  }));
552
583
  function getTaskPlanStatisticList(_x10, _x11) {
553
584
  return _getTaskPlanStatisticList.apply(this, arguments);
@@ -590,18 +621,18 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
590
621
  }, {
591
622
  key: "getFileList",
592
623
  value: function () {
593
- var _getFileList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(videoAccountId, needTaskCount, videoFromFolder) {
624
+ var _getFileList = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(videoAccountId, needTaskCount, videoFromFolder) {
594
625
  var fileList, videoList, _iterator4, _step4, filePath, _this$getCommandByPat, command, topicList;
595
- return _regeneratorRuntime().wrap(function _callee9$(_context9) {
596
- while (1) switch (_context9.prev = _context9.next) {
626
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
627
+ while (1) switch (_context10.prev = _context10.next) {
597
628
  case 0:
598
629
  fileList = fsDirVideoList(videoFromFolder);
599
630
  if (!(fileList.length === 0)) {
600
- _context9.next = 4;
631
+ _context10.next = 4;
601
632
  break;
602
633
  }
603
634
  console.log('文件夹没视频,跳过:', videoAccountId, videoFromFolder);
604
- return _context9.abrupt("return", {
635
+ return _context10.abrupt("return", {
605
636
  videoList: [],
606
637
  topicList: []
607
638
  });
@@ -609,72 +640,72 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
609
640
  console.log('fileList:', fileList.length, needTaskCount, videoFromFolder);
610
641
  videoList = []; // 获取视频
611
642
  _iterator4 = _createForOfIteratorHelper(fileList);
612
- _context9.prev = 7;
643
+ _context10.prev = 7;
613
644
  _iterator4.s();
614
645
  case 9:
615
646
  if ((_step4 = _iterator4.n()).done) {
616
- _context9.next = 25;
647
+ _context10.next = 25;
617
648
  break;
618
649
  }
619
650
  filePath = _step4.value;
620
651
  _this$getCommandByPat = this.getCommandByPath(filePath), command = _this$getCommandByPat.command;
621
652
  if (command) {
622
- _context9.next = 16;
653
+ _context10.next = 16;
623
654
  break;
624
655
  }
625
656
  videoList.push(filePath);
626
- _context9.next = 23;
657
+ _context10.next = 23;
627
658
  break;
628
659
  case 16:
629
- _context9.t0 = command;
630
- _context9.next = _context9.t0 === 'needDel' ? 19 : _context9.t0 === 'waitPublish' ? 21 : 23;
660
+ _context10.t0 = command;
661
+ _context10.next = _context10.t0 === 'needDel' ? 19 : _context10.t0 === 'waitPublish' ? 21 : 23;
631
662
  break;
632
663
  case 19:
633
664
  delFile(filePath);
634
- return _context9.abrupt("break", 23);
665
+ return _context10.abrupt("break", 23);
635
666
  case 21:
636
667
  this.fileTimeTooLongNeedDel(filePath);
637
- return _context9.abrupt("break", 23);
668
+ return _context10.abrupt("break", 23);
638
669
  case 23:
639
- _context9.next = 9;
670
+ _context10.next = 9;
640
671
  break;
641
672
  case 25:
642
- _context9.next = 30;
673
+ _context10.next = 30;
643
674
  break;
644
675
  case 27:
645
- _context9.prev = 27;
646
- _context9.t1 = _context9["catch"](7);
647
- _iterator4.e(_context9.t1);
676
+ _context10.prev = 27;
677
+ _context10.t1 = _context10["catch"](7);
678
+ _iterator4.e(_context10.t1);
648
679
  case 30:
649
- _context9.prev = 30;
680
+ _context10.prev = 30;
650
681
  _iterator4.f();
651
- return _context9.finish(30);
682
+ return _context10.finish(30);
652
683
  case 33:
653
684
  if (!(videoList.length === 0)) {
654
- _context9.next = 36;
685
+ _context10.next = 36;
655
686
  break;
656
687
  }
657
688
  console.log('文件夹 没 可用的视频,跳过 2:', videoAccountId, videoFromFolder);
658
- return _context9.abrupt("return", {
689
+ return _context10.abrupt("return", {
659
690
  videoList: videoList,
660
691
  topicList: []
661
692
  });
662
693
  case 36:
663
- _context9.next = 38;
694
+ _context10.next = 38;
664
695
  return this.getTopicList(videoFromFolder).catch(function () {
665
696
  return [];
666
697
  });
667
698
  case 38:
668
- topicList = _context9.sent;
669
- return _context9.abrupt("return", {
699
+ topicList = _context10.sent;
700
+ return _context10.abrupt("return", {
670
701
  videoList: this.getaArrayRandList(videoList, needTaskCount),
671
702
  topicList: this.getaArrayRandList(topicList, 5)
672
703
  });
673
704
  case 40:
674
705
  case "end":
675
- return _context9.stop();
706
+ return _context10.stop();
676
707
  }
677
- }, _callee9, this, [[7, 27, 30, 33]]);
708
+ }, _callee10, this, [[7, 27, 30, 33]]);
678
709
  }));
679
710
  function getFileList(_x12, _x13, _x14) {
680
711
  return _getFileList.apply(this, arguments);
@@ -712,19 +743,19 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
712
743
  }, {
713
744
  key: "videoRename",
714
745
  value: function () {
715
- var _videoRename = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(videoPath) {
746
+ var _videoRename = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(videoPath) {
716
747
  var videoPathInfo, newName, newFilePath;
717
- return _regeneratorRuntime().wrap(function _callee11$(_context11) {
718
- while (1) switch (_context11.prev = _context11.next) {
748
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
749
+ while (1) switch (_context12.prev = _context12.next) {
719
750
  case 0:
720
751
  videoPathInfo = videoPath.split(/[\/\\]/g);
721
752
  newName = "\u25C0waitPublish-".concat(Math.floor(Date.now() * 0.001), "\u25B6") + this.getFileName(videoPath);
722
753
  newFilePath = videoPathInfo.slice(0, -1).join('/') + "/".concat(newName);
723
754
  console.log('newFilePath:', newFilePath);
724
- return _context11.abrupt("return", new Promise( /*#__PURE__*/function () {
725
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(resolve, reject) {
726
- return _regeneratorRuntime().wrap(function _callee10$(_context10) {
727
- while (1) switch (_context10.prev = _context10.next) {
755
+ return _context12.abrupt("return", new Promise( /*#__PURE__*/function () {
756
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(resolve, reject) {
757
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
758
+ while (1) switch (_context11.prev = _context11.next) {
728
759
  case 0:
729
760
  window.getBridge().fs.rename(videoPath, newFilePath, function (err) {
730
761
  if (err) {
@@ -736,9 +767,9 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
736
767
  });
737
768
  case 1:
738
769
  case "end":
739
- return _context10.stop();
770
+ return _context11.stop();
740
771
  }
741
- }, _callee10);
772
+ }, _callee11);
742
773
  }));
743
774
  return function (_x16, _x17) {
744
775
  return _ref2.apply(this, arguments);
@@ -746,9 +777,9 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
746
777
  }()));
747
778
  case 5:
748
779
  case "end":
749
- return _context11.stop();
780
+ return _context12.stop();
750
781
  }
751
- }, _callee11, this);
782
+ }, _callee12, this);
752
783
  }));
753
784
  function videoRename(_x15) {
754
785
  return _videoRename.apply(this, arguments);
@@ -773,11 +804,11 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
773
804
  }, {
774
805
  key: "checkDelFile",
775
806
  value: function () {
776
- var _checkDelFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(accountId, videoFromFolder) {
807
+ var _checkDelFile = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(accountId, videoFromFolder) {
777
808
  var _this3 = this;
778
809
  var folderVideoList, planList;
779
- return _regeneratorRuntime().wrap(function _callee12$(_context12) {
780
- while (1) switch (_context12.prev = _context12.next) {
810
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
811
+ while (1) switch (_context13.prev = _context13.next) {
781
812
  case 0:
782
813
  folderVideoList = this.getLocalVideoList(videoFromFolder).map(function (filePath) {
783
814
  return filePath.replace(/\\/g, '/');
@@ -804,9 +835,9 @@ var ActiveAccountModeTask = /*#__PURE__*/function () {
804
835
  });
805
836
  case 3:
806
837
  case "end":
807
- return _context12.stop();
838
+ return _context13.stop();
808
839
  }
809
- }, _callee12, this);
840
+ }, _callee13, this);
810
841
  }));
811
842
  function checkDelFile(_x18, _x19) {
812
843
  return _checkDelFile.apply(this, arguments);
@@ -29,7 +29,7 @@ export var VideoPublishTaskPlanStatusList = [{
29
29
  status: 'repeal',
30
30
  icon: /*#__PURE__*/_jsx(StopOutlined, {}),
31
31
  title: '已废除',
32
- color: ''
32
+ color: '#F60'
33
33
  }];
34
34
  var VideoPublishTaskPlanStatusDict = function () {
35
35
  var dict = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "component-shipinlv",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",