component-shipinlv 2.3.6 → 2.3.8
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/Auth/index.js +45 -26
- package/dist/AuthClient/qr/index.css.js +1 -1
- package/dist/PhonePublish/account-manage/home.d.ts +11 -0
- package/dist/PhonePublish/account-manage/home.js +243 -0
- package/dist/PhonePublish/account-manage/home.less +28 -0
- package/dist/PhonePublish/account-manage/index.d.ts +3 -0
- package/dist/PhonePublish/account-manage/index.js +56 -0
- package/dist/PhonePublish/account-manage/index.less +59 -0
- package/dist/PhonePublish/account-manage/list.d.ts +17 -0
- package/dist/PhonePublish/account-manage/list.js +443 -0
- package/dist/PhonePublish/account-manage/list.less +95 -0
- package/dist/PhonePublish/account-manage/setting/index.d.ts +6 -0
- package/dist/PhonePublish/account-manage/setting/index.js +199 -0
- package/dist/PhonePublish/account-manage/setting/index.less +11 -0
- package/dist/PhonePublish/create-task/base/index.d.ts +10 -0
- package/dist/PhonePublish/create-task/base/index.js +386 -0
- package/dist/PhonePublish/create-task/base/index.less +64 -0
- package/dist/PhonePublish/create-task/getVideoGoodsUrl.d.ts +2 -0
- package/dist/PhonePublish/create-task/getVideoGoodsUrl.js +136 -0
- package/dist/PhonePublish/create-task/hour-enabled.d.ts +9 -0
- package/dist/PhonePublish/create-task/hour-enabled.js +42 -0
- package/dist/PhonePublish/create-task/hour-enabled.less +24 -0
- package/dist/PhonePublish/create-task/index.d.ts +11 -0
- package/dist/PhonePublish/create-task/index.js +449 -0
- package/dist/PhonePublish/create-task/index.less +75 -0
- package/dist/PhonePublish/create-task/select-list.css.d.ts +5 -0
- package/dist/PhonePublish/create-task/select-list.css.js +6 -0
- package/dist/PhonePublish/create-task/select-list.d.ts +8 -0
- package/dist/PhonePublish/create-task/select-list.js +304 -0
- package/dist/PhonePublish/create-task/task-list.css.d.ts +5 -0
- package/dist/PhonePublish/create-task/task-list.css.js +6 -0
- package/dist/PhonePublish/create-task/task-list.d.ts +9 -0
- package/dist/PhonePublish/create-task/task-list.js +323 -0
- package/dist/PhonePublish/index.css.d.ts +2 -0
- package/dist/PhonePublish/index.css.js +35 -0
- package/dist/PhonePublish/index.d.ts +15 -0
- package/dist/PhonePublish/index.js +191 -0
- package/dist/PhonePublish/index.less +55 -0
- package/dist/PhonePublish/lib/chrome-quit.d.ts +2 -0
- package/dist/PhonePublish/lib/chrome-quit.js +20 -0
- package/dist/PhonePublish/log/index.d.ts +8 -0
- package/dist/PhonePublish/log/index.js +186 -0
- package/dist/PhonePublish/log/index.less +81 -0
- package/dist/PhonePublish/publish-task-plan/index.d.ts +9 -0
- package/dist/PhonePublish/publish-task-plan/index.js +32 -0
- package/dist/PhonePublish/publish-task-plan/index.less +4 -0
- package/dist/PhonePublish/publish-task-plan/tool-bak.txt +219 -0
- package/dist/PhonePublish/publish-task-plan/tool.d.ts +29 -0
- package/dist/PhonePublish/publish-task-plan/tool.js +720 -0
- package/dist/PhonePublish/task-list/index.d.ts +8 -0
- package/dist/PhonePublish/task-list/index.js +224 -0
- package/dist/PhonePublish/task-list/index.less +8 -0
- package/dist/PhonePublish/task-list/plan/list.d.ts +12 -0
- package/dist/PhonePublish/task-list/plan/list.js +290 -0
- package/dist/PhonePublish/task-list/plan/list.less +87 -0
- package/dist/PhonePublish/task-list/plan/operate.d.ts +8 -0
- package/dist/PhonePublish/task-list/plan/operate.js +145 -0
- package/dist/PhonePublish/task-list/plan/query.d.ts +8 -0
- package/dist/PhonePublish/task-list/plan/query.js +89 -0
- package/dist/PhonePublish/task-list/plan/query.less +9 -0
- package/dist/PhonePublish/task-list/plan/status.d.ts +13 -0
- package/dist/PhonePublish/task-list/plan/status.js +53 -0
- package/dist/PhonePublish/task-list/query.d.ts +8 -0
- package/dist/PhonePublish/task-list/query.js +76 -0
- package/dist/PhonePublish/task-list/query.less +19 -0
- package/dist/PhonePublish/task-list/who-can-view.d.ts +12 -0
- package/dist/PhonePublish/task-list/who-can-view.js +37 -0
- package/dist/PhonePublish/video-account/ban/index.d.ts +10 -0
- package/dist/PhonePublish/video-account/ban/index.js +94 -0
- package/dist/PhonePublish/video-account/ban/index.less +4 -0
- package/dist/PhonePublish/video-account/base-info.d.ts +13 -0
- package/dist/PhonePublish/video-account/base-info.js +75 -0
- package/dist/PhonePublish/video-account/base-info.less +92 -0
- package/dist/PhonePublish/video-account/create.d.ts +8 -0
- package/dist/PhonePublish/video-account/create.js +174 -0
- package/dist/PhonePublish/video-account/group.d.ts +9 -0
- package/dist/PhonePublish/video-account/group.js +255 -0
- package/dist/PhonePublish/video-account/group.less +10 -0
- package/dist/PhonePublish/video-account/index.d.ts +8 -0
- package/dist/PhonePublish/video-account/index.js +403 -0
- package/dist/PhonePublish/video-account/index.less +92 -0
- package/dist/PhonePublish/video-account/query.d.ts +8 -0
- package/dist/PhonePublish/video-account/query.js +115 -0
- package/dist/PhonePublish/video-account/query.less +18 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/index.d.ts +8 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/index.js +173 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/index.less +3 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/kind-list.d.ts +7 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/kind-list.js +22 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/query.d.ts +9 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/query.js +54 -0
- package/dist/PhonePublish/video-publish-statistic/account-trend/query.less +3 -0
- package/dist/PhonePublish/video-publish-statistic/index.d.ts +2 -0
- package/dist/PhonePublish/video-publish-statistic/index.js +37 -0
- package/dist/PhonePublish/video-publish-statistic/kind.d.ts +16 -0
- package/dist/PhonePublish/video-publish-statistic/kind.js +57 -0
- package/dist/PhonePublish/video-publish-statistic/operation/list.d.ts +7 -0
- package/dist/PhonePublish/video-publish-statistic/operation/list.js +242 -0
- package/dist/PhonePublish/video-publish-statistic/operation/list.less +10 -0
- package/dist/PhonePublish/video-publish-statistic/operation/query.d.ts +8 -0
- package/dist/PhonePublish/video-publish-statistic/operation/query.js +56 -0
- package/dist/PhonePublish/video-publish-statistic/operation/query.less +3 -0
- package/dist/PhonePublish/video-publish-statistic/publish-plan/list.d.ts +8 -0
- package/dist/PhonePublish/video-publish-statistic/publish-plan/list.js +257 -0
- package/dist/PhonePublish/video-publish-statistic/publish-plan/list.less +105 -0
- package/dist/PhonePublish/video-publish-statistic/publish-plan/query.d.ts +9 -0
- package/dist/PhonePublish/video-publish-statistic/publish-plan/query.js +79 -0
- package/dist/PhonePublish/video-publish-statistic/publish-plan/query.less +3 -0
- package/dist/VideoPublish/account-manage/list.js +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/lib/Tool.d.ts +1 -1
- package/dist/phone/index.d.ts +8 -0
- package/dist/phone/index.js +62 -0
- package/dist/phone/index.less +170 -0
- package/dist/typings.d.ts +1 -1
- package/package.json +1 -1
@@ -0,0 +1,720 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
3
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
4
|
+
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
5
|
+
import _createClass from "@babel/runtime/helpers/esm/createClass";
|
6
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
7
|
+
import * as VideoPublishCrawlerTaskController from "../../service/api/VideoPublishCrawlerTaskController";
|
8
|
+
import * as VideoPublishVideoAccountController from "../../service/api/VideoPublishVideoAccountController";
|
9
|
+
import sleep from "../../lib/sleep";
|
10
|
+
import event from "../../lib/event";
|
11
|
+
import AccountManageSettingConfig from "../../lib/accountManageSettingConfig";
|
12
|
+
import SSE from "../../component/sse";
|
13
|
+
import param from "../../component/param";
|
14
|
+
import { notification } from "antd";
|
15
|
+
import openChrome from "../../lib/openChrome";
|
16
|
+
import * as LocalVideoPublishTaskController from "../../service/local/VideoPublishTaskController";
|
17
|
+
import isFileExist from "../../component/isFileExist";
|
18
|
+
import Tool from "../../lib/Tool";
|
19
|
+
import chromeQuit from "../../VideoPublish/lib/chrome-quit";
|
20
|
+
import platform from "../../lib/platform";
|
21
|
+
var PublishTaskPlanClass = /*#__PURE__*/function () {
|
22
|
+
function PublishTaskPlanClass(env) {
|
23
|
+
var clientIdentity = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
24
|
+
var options = arguments.length > 2 ? arguments[2] : undefined;
|
25
|
+
_classCallCheck(this, PublishTaskPlanClass);
|
26
|
+
_defineProperty(this, "timeLoopMillisecond", 15 * 1e3);
|
27
|
+
_defineProperty(this, "isPublishing", false);
|
28
|
+
_defineProperty(this, "env", '');
|
29
|
+
_defineProperty(this, "clientIdentity", '');
|
30
|
+
_defineProperty(this, "lastPublishHeart", 0);
|
31
|
+
_defineProperty(this, "MaxNotHeartSecond", 2 * 60);
|
32
|
+
_defineProperty(this, "taskDetail", {
|
33
|
+
emptyLoopTimeSecond: 10,
|
34
|
+
platformVideoAccountId: '',
|
35
|
+
platform: 'douyin',
|
36
|
+
nickname: '',
|
37
|
+
chromeProfileName: '',
|
38
|
+
taskInfo: {
|
39
|
+
taskType: '',
|
40
|
+
taskId: 0
|
41
|
+
},
|
42
|
+
proxyInfo: {}
|
43
|
+
});
|
44
|
+
_defineProperty(this, "options", {
|
45
|
+
// onVideoPublish: ( proxyInfo, query ) => {
|
46
|
+
// return Promise.resolve( true );
|
47
|
+
// },
|
48
|
+
onLog: function onLog() {}
|
49
|
+
});
|
50
|
+
this.env = env;
|
51
|
+
this.clientIdentity = clientIdentity;
|
52
|
+
this.options = options;
|
53
|
+
}
|
54
|
+
_createClass(PublishTaskPlanClass, [{
|
55
|
+
key: "onInit",
|
56
|
+
value: function onInit() {
|
57
|
+
var _this2 = this;
|
58
|
+
var _this = this;
|
59
|
+
Tool.event.on('ws-message.publish-video-publish-heart', function (data) {
|
60
|
+
if (data.dataType !== "publish-video-publish-heart") {
|
61
|
+
return;
|
62
|
+
}
|
63
|
+
if (_this.lastPublishHeart <= 0) {
|
64
|
+
console.log('last published heart empty:', data);
|
65
|
+
return;
|
66
|
+
}
|
67
|
+
console.log('last published heart up:', data);
|
68
|
+
_this.lastPublishHeart = Date.now();
|
69
|
+
});
|
70
|
+
setInterval( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
71
|
+
var errLog;
|
72
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
73
|
+
while (1) switch (_context.prev = _context.next) {
|
74
|
+
case 0:
|
75
|
+
if (!_this.isPublishing) {
|
76
|
+
_context.next = 13;
|
77
|
+
break;
|
78
|
+
}
|
79
|
+
if (!(_this.lastPublishHeart > 0)) {
|
80
|
+
_context.next = 12;
|
81
|
+
break;
|
82
|
+
}
|
83
|
+
if (!(_this.lastPublishHeart + _this.MaxNotHeartSecond * 1e3 < Date.now())) {
|
84
|
+
_context.next = 12;
|
85
|
+
break;
|
86
|
+
}
|
87
|
+
_this.lastPublishHeart = 0;
|
88
|
+
// 浏览器卡住了
|
89
|
+
errLog = {
|
90
|
+
platform: _this.taskDetail.platform,
|
91
|
+
platformAccountId: _this.taskDetail.platformVideoAccountId,
|
92
|
+
code: 'chrome-block',
|
93
|
+
message: '浏览器因为某种原因卡住了',
|
94
|
+
nickname: _this.taskDetail.nickname,
|
95
|
+
status: 'fail',
|
96
|
+
taskId: _this.taskDetail.taskInfo.taskId,
|
97
|
+
eventType: _this.taskDetail.taskInfo.taskType
|
98
|
+
}; // event.run('lo g', errL og);
|
99
|
+
_this.onLog(errLog);
|
100
|
+
_context.next = 8;
|
101
|
+
return _this.onReport(false, errLog.code, errLog.message, {
|
102
|
+
taskType: _this.taskDetail.taskInfo.taskType,
|
103
|
+
taskId: _this.taskDetail.taskInfo.taskId,
|
104
|
+
platform: _this.taskDetail.platform,
|
105
|
+
platformAccountId: _this.taskDetail.platformVideoAccountId
|
106
|
+
}).catch(function (err) {});
|
107
|
+
case 8:
|
108
|
+
_context.next = 10;
|
109
|
+
return chromeQuit({
|
110
|
+
platform: _this.taskDetail.platform,
|
111
|
+
platformVideoAccountId: _this.taskDetail.platformVideoAccountId,
|
112
|
+
chromeProfileName: _this.taskDetail.chromeProfileName
|
113
|
+
}).catch(function (err) {});
|
114
|
+
case 10:
|
115
|
+
// 关闭浏览器,需要时间
|
116
|
+
setTimeout(function () {
|
117
|
+
_this.isPublishing = false;
|
118
|
+
}, 10e3);
|
119
|
+
return _context.abrupt("return");
|
120
|
+
case 12:
|
121
|
+
return _context.abrupt("return");
|
122
|
+
case 13:
|
123
|
+
_this2.getWork();
|
124
|
+
case 14:
|
125
|
+
case "end":
|
126
|
+
return _context.stop();
|
127
|
+
}
|
128
|
+
}, _callee);
|
129
|
+
})), 3e3);
|
130
|
+
|
131
|
+
// chrome 提交的 用户信息;
|
132
|
+
event.on('ws-message.chrome-publish-video-account-info', function (result) {
|
133
|
+
if (result.dataType !== 'chrome-publish-video-account-info') {
|
134
|
+
return;
|
135
|
+
}
|
136
|
+
console.log('ws-message chrome account:', result);
|
137
|
+
var data = result.data;
|
138
|
+
VideoPublishVideoAccountController.create(data, {
|
139
|
+
env: _this2.env
|
140
|
+
});
|
141
|
+
});
|
142
|
+
|
143
|
+
// event.on('ws-message.publish-video-log-publish-video', async ( query: ApiLocal.DataFlowResult<PublishVideo.PublishVideoLog> ) => {
|
144
|
+
// if( query.dataType !== 'publish-video-log-publish-video' ){
|
145
|
+
// return;
|
146
|
+
// }
|
147
|
+
// const data: PublishVideo.PublishVideoLog = query.data;
|
148
|
+
// if( ! ['fail', 'success'].includes( data.status ) ){
|
149
|
+
// return;
|
150
|
+
// }
|
151
|
+
//
|
152
|
+
// await this.on Report( data.status === 'success', data.message, {
|
153
|
+
// taskType: data.taskType,
|
154
|
+
// taskId: data.taskId,
|
155
|
+
// platform: data.platform,
|
156
|
+
// platformAccountId: '',
|
157
|
+
// }).catch( err => {
|
158
|
+
//
|
159
|
+
// });
|
160
|
+
//
|
161
|
+
// await this.doWorkWait();
|
162
|
+
// });
|
163
|
+
|
164
|
+
// 桥
|
165
|
+
// this.options.onLog?.( ( query: any ) => {
|
166
|
+
// event.run('shipinlv-video-publish-log', query )
|
167
|
+
// });
|
168
|
+
}
|
169
|
+
}, {
|
170
|
+
key: "getWork",
|
171
|
+
value: function () {
|
172
|
+
var _getWork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
173
|
+
var settingConfig, taskDetail;
|
174
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
175
|
+
while (1) switch (_context2.prev = _context2.next) {
|
176
|
+
case 0:
|
177
|
+
settingConfig = AccountManageSettingConfig();
|
178
|
+
if (!settingConfig.disabledApplyTask) {
|
179
|
+
_context2.next = 3;
|
180
|
+
break;
|
181
|
+
}
|
182
|
+
return _context2.abrupt("return");
|
183
|
+
case 3:
|
184
|
+
this.isPublishing = true;
|
185
|
+
_context2.next = 6;
|
186
|
+
return this.onTaskGet().catch(function (err) {});
|
187
|
+
case 6:
|
188
|
+
taskDetail = _context2.sent;
|
189
|
+
if (taskDetail) {
|
190
|
+
_context2.next = 12;
|
191
|
+
break;
|
192
|
+
}
|
193
|
+
_context2.next = 10;
|
194
|
+
return sleep(this.timeLoopMillisecond);
|
195
|
+
case 10:
|
196
|
+
this.isPublishing = false;
|
197
|
+
return _context2.abrupt("return");
|
198
|
+
case 12:
|
199
|
+
this.taskDetail = taskDetail;
|
200
|
+
this.doWork(taskDetail);
|
201
|
+
case 14:
|
202
|
+
case "end":
|
203
|
+
return _context2.stop();
|
204
|
+
}
|
205
|
+
}, _callee2, this);
|
206
|
+
}));
|
207
|
+
function getWork() {
|
208
|
+
return _getWork.apply(this, arguments);
|
209
|
+
}
|
210
|
+
return getWork;
|
211
|
+
}()
|
212
|
+
}, {
|
213
|
+
key: "doWork",
|
214
|
+
value: function () {
|
215
|
+
var _doWork = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(taskDetail) {
|
216
|
+
var item, saveBaseData, errExistLog, coverExist, errVideoExistLog, videoExist, result, errMessage, code, errLog;
|
217
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
218
|
+
while (1) switch (_context3.prev = _context3.next) {
|
219
|
+
case 0:
|
220
|
+
if (taskDetail.emptyLoopTimeSecond > 10) {
|
221
|
+
this.timeLoopMillisecond = taskDetail.emptyLoopTimeSecond * 1e3;
|
222
|
+
}
|
223
|
+
console.log("taskDetail;", taskDetail);
|
224
|
+
item = taskDetail.taskInfo;
|
225
|
+
if (!(item.taskType === '')) {
|
226
|
+
_context3.next = 8;
|
227
|
+
break;
|
228
|
+
}
|
229
|
+
console.log('无任务');
|
230
|
+
_context3.next = 7;
|
231
|
+
return this.doWorkWait();
|
232
|
+
case 7:
|
233
|
+
return _context3.abrupt("return");
|
234
|
+
case 8:
|
235
|
+
saveBaseData = {
|
236
|
+
taskType: item.taskType,
|
237
|
+
taskId: item.taskId,
|
238
|
+
platform: taskDetail.platform,
|
239
|
+
platformAccountId: taskDetail.platformVideoAccountId
|
240
|
+
};
|
241
|
+
_context3.t0 = item.taskType;
|
242
|
+
_context3.next = _context3.t0 === "publish-video" ? 12 : 37;
|
243
|
+
break;
|
244
|
+
case 12:
|
245
|
+
if (item.publishVideo) {
|
246
|
+
_context3.next = 16;
|
247
|
+
break;
|
248
|
+
}
|
249
|
+
console.warn("item publishVideo is empty!");
|
250
|
+
this.onReport(false, '', "publishVideo 不存在", saveBaseData);
|
251
|
+
return _context3.abrupt("break", 43);
|
252
|
+
case 16:
|
253
|
+
if (!item.publishVideo.publishCoverUrl) {
|
254
|
+
_context3.next = 22;
|
255
|
+
break;
|
256
|
+
}
|
257
|
+
errExistLog = {
|
258
|
+
platform: taskDetail.platform,
|
259
|
+
platformAccountId: taskDetail.platformVideoAccountId,
|
260
|
+
code: 'cover-not-exist',
|
261
|
+
nickname: taskDetail.nickname,
|
262
|
+
message: "",
|
263
|
+
status: 'fail',
|
264
|
+
taskId: item.taskId,
|
265
|
+
eventType: 'task-kind'
|
266
|
+
};
|
267
|
+
_context3.next = 20;
|
268
|
+
return isFileExist(item.publishVideo.publishCoverUrl).catch(function (err) {});
|
269
|
+
case 20:
|
270
|
+
coverExist = _context3.sent;
|
271
|
+
if (!coverExist || !coverExist.isExist) {
|
272
|
+
item.publishVideo.publishCoverUrl = '';
|
273
|
+
errExistLog.message = '预判定:封面文件 本身已经不存在(可能被清理删除),将采用系统推荐封面<Divider />';
|
274
|
+
this.onLog(errExistLog);
|
275
|
+
}
|
276
|
+
case 22:
|
277
|
+
if (!item.publishVideo.videoUrl) {
|
278
|
+
_context3.next = 33;
|
279
|
+
break;
|
280
|
+
}
|
281
|
+
errVideoExistLog = {
|
282
|
+
platform: taskDetail.platform,
|
283
|
+
platformAccountId: taskDetail.platformVideoAccountId,
|
284
|
+
code: 'video-not-exist',
|
285
|
+
nickname: taskDetail.nickname,
|
286
|
+
message: "",
|
287
|
+
status: 'fail',
|
288
|
+
taskId: item.taskId,
|
289
|
+
eventType: 'task-kind'
|
290
|
+
};
|
291
|
+
_context3.next = 26;
|
292
|
+
return isFileExist(item.publishVideo.videoUrl).catch(function (err) {});
|
293
|
+
case 26:
|
294
|
+
videoExist = _context3.sent;
|
295
|
+
if (!(!videoExist || !videoExist.isExist)) {
|
296
|
+
_context3.next = 33;
|
297
|
+
break;
|
298
|
+
}
|
299
|
+
item.publishVideo.publishCoverUrl = '';
|
300
|
+
errVideoExistLog.message = '视频文件 本身已经不存在(可能被清理删除),任务失败';
|
301
|
+
this.onLog(errVideoExistLog);
|
302
|
+
this.onReport(false, '', errVideoExistLog.message, saveBaseData);
|
303
|
+
return _context3.abrupt("break", 43);
|
304
|
+
case 33:
|
305
|
+
_context3.next = 35;
|
306
|
+
return this.onPublishVideo(taskDetail.platform, taskDetail.platformVideoAccountId, taskDetail.nickname, taskDetail.chromeProfileName, taskDetail.taskInfo, taskDetail.proxyInfo).catch(function (err) {
|
307
|
+
console.warn("onPublishVideo err:", err);
|
308
|
+
// this.on Report(false, err?.message, saveBaseData );
|
309
|
+
});
|
310
|
+
case 35:
|
311
|
+
result = _context3.sent;
|
312
|
+
return _context3.abrupt("break", 43);
|
313
|
+
case 37:
|
314
|
+
errMessage = '暂不支持 类型:' + item.taskType;
|
315
|
+
console.log(errMessage);
|
316
|
+
code = 'not-support-task-type';
|
317
|
+
errLog = {
|
318
|
+
platform: taskDetail.platform,
|
319
|
+
platformAccountId: taskDetail.platformVideoAccountId,
|
320
|
+
code: code,
|
321
|
+
nickname: taskDetail.nickname,
|
322
|
+
message: errMessage,
|
323
|
+
status: 'fail',
|
324
|
+
taskId: item.taskId,
|
325
|
+
eventType: 'task-kind'
|
326
|
+
};
|
327
|
+
this.onLog(errLog);
|
328
|
+
this.onReport(false, code, errMessage, saveBaseData);
|
329
|
+
case 43:
|
330
|
+
_context3.next = 45;
|
331
|
+
return this.doWorkWait();
|
332
|
+
case 45:
|
333
|
+
case "end":
|
334
|
+
return _context3.stop();
|
335
|
+
}
|
336
|
+
}, _callee3, this);
|
337
|
+
}));
|
338
|
+
function doWork(_x) {
|
339
|
+
return _doWork.apply(this, arguments);
|
340
|
+
}
|
341
|
+
return doWork;
|
342
|
+
}()
|
343
|
+
}, {
|
344
|
+
key: "onLog",
|
345
|
+
value: function () {
|
346
|
+
var _onLog = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(query) {
|
347
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
348
|
+
while (1) switch (_context4.prev = _context4.next) {
|
349
|
+
case 0:
|
350
|
+
event.run('publish-video-log-publish-video', query);
|
351
|
+
this.options.onLog(query);
|
352
|
+
case 2:
|
353
|
+
case "end":
|
354
|
+
return _context4.stop();
|
355
|
+
}
|
356
|
+
}, _callee4, this);
|
357
|
+
}));
|
358
|
+
function onLog(_x2) {
|
359
|
+
return _onLog.apply(this, arguments);
|
360
|
+
}
|
361
|
+
return onLog;
|
362
|
+
}()
|
363
|
+
}, {
|
364
|
+
key: "doWorkWait",
|
365
|
+
value: function () {
|
366
|
+
var _doWorkWait = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
367
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
368
|
+
while (1) switch (_context5.prev = _context5.next) {
|
369
|
+
case 0:
|
370
|
+
_context5.next = 2;
|
371
|
+
return sleep(this.timeLoopMillisecond);
|
372
|
+
case 2:
|
373
|
+
this.isPublishing = false;
|
374
|
+
case 3:
|
375
|
+
case "end":
|
376
|
+
return _context5.stop();
|
377
|
+
}
|
378
|
+
}, _callee5, this);
|
379
|
+
}));
|
380
|
+
function doWorkWait() {
|
381
|
+
return _doWorkWait.apply(this, arguments);
|
382
|
+
}
|
383
|
+
return doWorkWait;
|
384
|
+
}()
|
385
|
+
}, {
|
386
|
+
key: "onReport",
|
387
|
+
value: function onReport(success, code,
|
388
|
+
// not-login
|
389
|
+
message, saveBaseData) {
|
390
|
+
// 发消息 , 不管结果,无论失败
|
391
|
+
LocalVideoPublishTaskController.sendMessageToPort(_objectSpread({
|
392
|
+
code: code,
|
393
|
+
success: success,
|
394
|
+
message: message
|
395
|
+
}, saveBaseData));
|
396
|
+
return VideoPublishCrawlerTaskController.report(_objectSpread({
|
397
|
+
success: success,
|
398
|
+
code: code,
|
399
|
+
message: message
|
400
|
+
}, saveBaseData), {
|
401
|
+
env: this.env
|
402
|
+
});
|
403
|
+
}
|
404
|
+
}, {
|
405
|
+
key: "onTaskGet",
|
406
|
+
value: function () {
|
407
|
+
var _onTaskGet = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
408
|
+
var env;
|
409
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
410
|
+
while (1) switch (_context6.prev = _context6.next) {
|
411
|
+
case 0:
|
412
|
+
event.run('task-apply');
|
413
|
+
env = this.env;
|
414
|
+
_context6.next = 4;
|
415
|
+
return VideoPublishCrawlerTaskController.apply({}, {
|
416
|
+
env: env
|
417
|
+
});
|
418
|
+
case 4:
|
419
|
+
return _context6.abrupt("return", _context6.sent);
|
420
|
+
case 5:
|
421
|
+
case "end":
|
422
|
+
return _context6.stop();
|
423
|
+
}
|
424
|
+
}, _callee6, this);
|
425
|
+
}));
|
426
|
+
function onTaskGet() {
|
427
|
+
return _onTaskGet.apply(this, arguments);
|
428
|
+
}
|
429
|
+
return onTaskGet;
|
430
|
+
}()
|
431
|
+
}, {
|
432
|
+
key: "onPublishVideo",
|
433
|
+
value: function () {
|
434
|
+
var _onPublishVideo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(platform, platformVideoAccountId, nickname, chromeProfileName, taskInfo, proxyInfo) {
|
435
|
+
var _this3 = this;
|
436
|
+
var _this;
|
437
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
438
|
+
while (1) switch (_context9.prev = _context9.next) {
|
439
|
+
case 0:
|
440
|
+
_this = this; // 发布抖音视频
|
441
|
+
_context9.next = 3;
|
442
|
+
return sleep(1);
|
443
|
+
case 3:
|
444
|
+
return _context9.abrupt("return", new Promise( /*#__PURE__*/function () {
|
445
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(resolve, reject) {
|
446
|
+
var settingConfig, publishResult, finishLog;
|
447
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
448
|
+
while (1) switch (_context8.prev = _context8.next) {
|
449
|
+
case 0:
|
450
|
+
settingConfig = AccountManageSettingConfig();
|
451
|
+
console.log('settingConfig 1:', settingConfig);
|
452
|
+
_this.lastPublishHeart = Date.now();
|
453
|
+
_context8.next = 5;
|
454
|
+
return _this.onPublishVideoDo(proxyInfo, {
|
455
|
+
platformVideoAccountId: platformVideoAccountId,
|
456
|
+
platform: platform,
|
457
|
+
chromeProfileName: chromeProfileName,
|
458
|
+
nickname: nickname,
|
459
|
+
open: settingConfig.isChromeOpen,
|
460
|
+
// 发布视频的时候是否打开图形界面
|
461
|
+
taskInfo: taskInfo
|
462
|
+
// taskInfo: {
|
463
|
+
// taskId: detail.taskId,
|
464
|
+
// taskType:
|
465
|
+
// publishVideo: {
|
466
|
+
// taskId: detail.taskId,
|
467
|
+
// title: detail.title, // "视频标题",
|
468
|
+
// introduction: detail.introduction, //"视频简介",
|
469
|
+
// videoKindTag: detail.videoKindTag, //"", // shopping | ""
|
470
|
+
// videoUrl: detail.videoUrl, //"视频地址",
|
471
|
+
// publishTime: detail.publishTime, //"2024-08-14 10:00", // 可以是int也可以是string
|
472
|
+
// kindTagValue: detail.kindTagValue, // "" // 抖音是商品链接 快手是商品relItemId
|
473
|
+
// }
|
474
|
+
// },
|
475
|
+
}, settingConfig).catch( /*#__PURE__*/function () {
|
476
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(err) {
|
477
|
+
var _err$message;
|
478
|
+
var msgInfo, code, message, errLog, errNew;
|
479
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
480
|
+
while (1) switch (_context7.prev = _context7.next) {
|
481
|
+
case 0:
|
482
|
+
// 基本不会到这里
|
483
|
+
console.warn('bridge. video Publish err:', err.code, err);
|
484
|
+
msgInfo = (err === null || err === void 0 || (_err$message = err.message) === null || _err$message === void 0 ? void 0 : _err$message.split('■')) || [];
|
485
|
+
code = '';
|
486
|
+
message = '';
|
487
|
+
if (msgInfo.length >= 2) {
|
488
|
+
code = msgInfo[0];
|
489
|
+
message = msgInfo.slice(1).join(' ');
|
490
|
+
} else {
|
491
|
+
message = (err === null || err === void 0 ? void 0 : err.message) || '';
|
492
|
+
}
|
493
|
+
errLog = {
|
494
|
+
platform: platform,
|
495
|
+
platformAccountId: platformVideoAccountId,
|
496
|
+
code: code,
|
497
|
+
message: message,
|
498
|
+
nickname: nickname,
|
499
|
+
status: 'fail',
|
500
|
+
taskId: taskInfo.taskId,
|
501
|
+
eventType: 'publish-video'
|
502
|
+
}; // event.run('lo g', errLog);
|
503
|
+
_this3.onLog(errLog);
|
504
|
+
_this3.onReport(false, code, err === null || err === void 0 ? void 0 : err.message, {
|
505
|
+
taskType: taskInfo.taskType,
|
506
|
+
taskId: taskInfo.taskId,
|
507
|
+
platform: platform,
|
508
|
+
platformAccountId: platformVideoAccountId
|
509
|
+
});
|
510
|
+
|
511
|
+
// 等一会,清理现场,关闭 chrome
|
512
|
+
_context7.next = 10;
|
513
|
+
return sleep(10e3);
|
514
|
+
case 10:
|
515
|
+
errNew = new Error(err === null || err === void 0 ? void 0 : err.message);
|
516
|
+
errNew.name = err.code;
|
517
|
+
reject(errNew);
|
518
|
+
|
519
|
+
// resolve( err );
|
520
|
+
case 13:
|
521
|
+
case "end":
|
522
|
+
return _context7.stop();
|
523
|
+
}
|
524
|
+
}, _callee7);
|
525
|
+
}));
|
526
|
+
return function (_x11) {
|
527
|
+
return _ref3.apply(this, arguments);
|
528
|
+
};
|
529
|
+
}());
|
530
|
+
case 5:
|
531
|
+
publishResult = _context8.sent;
|
532
|
+
_this.lastPublishHeart = 0;
|
533
|
+
if (publishResult) {
|
534
|
+
_context8.next = 10;
|
535
|
+
break;
|
536
|
+
}
|
537
|
+
console.log('publishResult empty');
|
538
|
+
return _context8.abrupt("return", publishResult);
|
539
|
+
case 10:
|
540
|
+
console.log("publishResult:", publishResult);
|
541
|
+
finishLog = {
|
542
|
+
platform: platform,
|
543
|
+
platformAccountId: platformVideoAccountId,
|
544
|
+
code: '',
|
545
|
+
message: '恭喜你,视频发布成功',
|
546
|
+
nickname: nickname,
|
547
|
+
status: 'finish',
|
548
|
+
taskId: taskInfo.taskId,
|
549
|
+
eventType: 'publish-video'
|
550
|
+
}; // event.run('lo g', errLog);
|
551
|
+
_this3.onLog(finishLog);
|
552
|
+
_context8.next = 15;
|
553
|
+
return sleep(1);
|
554
|
+
case 15:
|
555
|
+
_this3.onReport(true, '', '', {
|
556
|
+
taskType: taskInfo.taskType,
|
557
|
+
taskId: taskInfo.taskId,
|
558
|
+
platform: platform,
|
559
|
+
platformAccountId: platformVideoAccountId
|
560
|
+
});
|
561
|
+
|
562
|
+
// 等一会,清理现场,关闭 chrome
|
563
|
+
_context8.next = 18;
|
564
|
+
return sleep(10e3);
|
565
|
+
case 18:
|
566
|
+
resolve(true);
|
567
|
+
case 19:
|
568
|
+
case "end":
|
569
|
+
return _context8.stop();
|
570
|
+
}
|
571
|
+
}, _callee8);
|
572
|
+
}));
|
573
|
+
return function (_x9, _x10) {
|
574
|
+
return _ref2.apply(this, arguments);
|
575
|
+
};
|
576
|
+
}()));
|
577
|
+
case 4:
|
578
|
+
case "end":
|
579
|
+
return _context9.stop();
|
580
|
+
}
|
581
|
+
}, _callee9, this);
|
582
|
+
}));
|
583
|
+
function onPublishVideo(_x3, _x4, _x5, _x6, _x7, _x8) {
|
584
|
+
return _onPublishVideo.apply(this, arguments);
|
585
|
+
}
|
586
|
+
return onPublishVideo;
|
587
|
+
}()
|
588
|
+
}, {
|
589
|
+
key: "onPublishVideoDo",
|
590
|
+
value: function () {
|
591
|
+
var _onPublishVideoDo = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(proxyInfo, query, settingConfig) {
|
592
|
+
var _this4 = this;
|
593
|
+
var _this;
|
594
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
595
|
+
while (1) switch (_context10.prev = _context10.next) {
|
596
|
+
case 0:
|
597
|
+
_this = this;
|
598
|
+
return _context10.abrupt("return", new Promise(function (resolve, reject) {
|
599
|
+
var isOpened = false;
|
600
|
+
var sse = new SSE("http://localhost:".concat(window.__ShipinlvLocalServerPort || 61805, "/").concat("chrome/applyForPublishTaskSse".toLocaleLowerCase(), "?") + param({
|
601
|
+
data: JSON.stringify(_objectSpread(_objectSpread({}, query), {}, {
|
602
|
+
proxyInfo: proxyInfo
|
603
|
+
}))
|
604
|
+
}), function (lastEventId, data) {
|
605
|
+
if (lastEventId === 'start-do-task') {
|
606
|
+
//唤起 浏览器;
|
607
|
+
// event.run('publish-video-open-chrome', {
|
608
|
+
// platform: query.platform || 'douyin',
|
609
|
+
// platformAccountId: query.platformVideoAccountId,
|
610
|
+
// chromePath: settingConfig.chromePath,
|
611
|
+
// isOpen: query.open,
|
612
|
+
// });
|
613
|
+
_this.onLog({
|
614
|
+
platform: query.platform || 'douyin',
|
615
|
+
platformAccountId: query.platformVideoAccountId,
|
616
|
+
code: '',
|
617
|
+
nickname: query.nickname,
|
618
|
+
message: "<Divider orientation=\"left\">\u89C6\u9891\u8D26\u53F7\uFF1A".concat(query.nickname, "</Divider>"),
|
619
|
+
status: '',
|
620
|
+
taskId: query.taskInfo.taskId,
|
621
|
+
eventType: 'publish-video'
|
622
|
+
});
|
623
|
+
_this.onLog({
|
624
|
+
platform: query.platform || 'douyin',
|
625
|
+
platformAccountId: query.platformVideoAccountId,
|
626
|
+
code: '',
|
627
|
+
nickname: query.nickname,
|
628
|
+
message: '接到任务,准备启动 谷歌浏览器',
|
629
|
+
status: '',
|
630
|
+
taskId: query.taskInfo.taskId,
|
631
|
+
eventType: 'publish-video'
|
632
|
+
});
|
633
|
+
var openUrlDict = {
|
634
|
+
douyin: 'https://creator.douyin.com/creator-micro/content/upload',
|
635
|
+
kuaishou: 'https://cp.kuaishou.com/article/publish/video'
|
636
|
+
};
|
637
|
+
openChrome({
|
638
|
+
action: 'publish',
|
639
|
+
platform: query.platform || 'douyin',
|
640
|
+
platformAccountId: query.platformVideoAccountId,
|
641
|
+
nickname: query.nickname,
|
642
|
+
taskId: query.taskInfo.taskId,
|
643
|
+
url: openUrlDict[query.platform] || '',
|
644
|
+
chromePath: settingConfig.chromePath,
|
645
|
+
chromeProfileName: query.chromeProfileName,
|
646
|
+
isOpen: query.open
|
647
|
+
}, false, _this4.env);
|
648
|
+
} else if (lastEventId === 'fail') {
|
649
|
+
// query.onDownFail( data );
|
650
|
+
// this.on Report( false, data, {
|
651
|
+
// taskType: query.taskInfo.taskType,
|
652
|
+
// taskId: query.taskInfo.taskId,
|
653
|
+
// platform: query.platform || 'douyin',
|
654
|
+
// platformAccountId: query.platformVideoAccountId,
|
655
|
+
// });
|
656
|
+
var failErr = new Error(data);
|
657
|
+
reject(failErr);
|
658
|
+
} else if (lastEventId === 'finish') {
|
659
|
+
// _this.onLog( {
|
660
|
+
// platform: query.platform || 'douyin',
|
661
|
+
// platformAccountId: query.platformVideoAccountId,
|
662
|
+
// code: '',
|
663
|
+
// message: data,
|
664
|
+
// status: 'success',
|
665
|
+
// taskId: query.taskInfo.taskId,
|
666
|
+
// eventType: 'publish-video',
|
667
|
+
// });
|
668
|
+
|
669
|
+
resolve(true);
|
670
|
+
} else {
|
671
|
+
// @ts-ignore
|
672
|
+
var status = "".concat(lastEventId);
|
673
|
+
_this.onLog({
|
674
|
+
platform: query.platform || 'douyin',
|
675
|
+
platformAccountId: query.platformVideoAccountId,
|
676
|
+
code: '',
|
677
|
+
nickname: query.nickname,
|
678
|
+
message: data,
|
679
|
+
status: status,
|
680
|
+
taskId: query.taskInfo.taskId,
|
681
|
+
eventType: 'publish-video'
|
682
|
+
});
|
683
|
+
}
|
684
|
+
}, function () {
|
685
|
+
isOpened = true;
|
686
|
+
}, function () {}, function (err) {
|
687
|
+
console.log('down file err:', err);
|
688
|
+
var description = '发布客户端似乎不正常,请检查:' + (err === null || err === void 0 ? void 0 : err.message);
|
689
|
+
if (!isOpened) {
|
690
|
+
notification.error({
|
691
|
+
duration: 30 * 60,
|
692
|
+
message: "发布失败",
|
693
|
+
description: description
|
694
|
+
});
|
695
|
+
}
|
696
|
+
// _this?.on Report( false, description, {
|
697
|
+
// taskType: query.taskInfo.taskType,
|
698
|
+
// taskId: query.taskInfo.taskId,
|
699
|
+
// platform: query.platform || 'douyin',
|
700
|
+
// platformAccountId: query.platformVideoAccountId,
|
701
|
+
// });
|
702
|
+
});
|
703
|
+
|
704
|
+
sse.onInit();
|
705
|
+
}));
|
706
|
+
case 2:
|
707
|
+
case "end":
|
708
|
+
return _context10.stop();
|
709
|
+
}
|
710
|
+
}, _callee10, this);
|
711
|
+
}));
|
712
|
+
function onPublishVideoDo(_x12, _x13, _x14) {
|
713
|
+
return _onPublishVideoDo.apply(this, arguments);
|
714
|
+
}
|
715
|
+
return onPublishVideoDo;
|
716
|
+
}()
|
717
|
+
}]);
|
718
|
+
return PublishTaskPlanClass;
|
719
|
+
}();
|
720
|
+
export default PublishTaskPlanClass;
|