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