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.
Files changed (117) hide show
  1. package/dist/Auth/index.js +45 -26
  2. package/dist/AuthClient/qr/index.css.js +1 -1
  3. package/dist/PhonePublish/account-manage/home.d.ts +11 -0
  4. package/dist/PhonePublish/account-manage/home.js +243 -0
  5. package/dist/PhonePublish/account-manage/home.less +28 -0
  6. package/dist/PhonePublish/account-manage/index.d.ts +3 -0
  7. package/dist/PhonePublish/account-manage/index.js +56 -0
  8. package/dist/PhonePublish/account-manage/index.less +59 -0
  9. package/dist/PhonePublish/account-manage/list.d.ts +17 -0
  10. package/dist/PhonePublish/account-manage/list.js +443 -0
  11. package/dist/PhonePublish/account-manage/list.less +95 -0
  12. package/dist/PhonePublish/account-manage/setting/index.d.ts +6 -0
  13. package/dist/PhonePublish/account-manage/setting/index.js +199 -0
  14. package/dist/PhonePublish/account-manage/setting/index.less +11 -0
  15. package/dist/PhonePublish/create-task/base/index.d.ts +10 -0
  16. package/dist/PhonePublish/create-task/base/index.js +386 -0
  17. package/dist/PhonePublish/create-task/base/index.less +64 -0
  18. package/dist/PhonePublish/create-task/getVideoGoodsUrl.d.ts +2 -0
  19. package/dist/PhonePublish/create-task/getVideoGoodsUrl.js +136 -0
  20. package/dist/PhonePublish/create-task/hour-enabled.d.ts +9 -0
  21. package/dist/PhonePublish/create-task/hour-enabled.js +42 -0
  22. package/dist/PhonePublish/create-task/hour-enabled.less +24 -0
  23. package/dist/PhonePublish/create-task/index.d.ts +11 -0
  24. package/dist/PhonePublish/create-task/index.js +449 -0
  25. package/dist/PhonePublish/create-task/index.less +75 -0
  26. package/dist/PhonePublish/create-task/select-list.css.d.ts +5 -0
  27. package/dist/PhonePublish/create-task/select-list.css.js +6 -0
  28. package/dist/PhonePublish/create-task/select-list.d.ts +8 -0
  29. package/dist/PhonePublish/create-task/select-list.js +304 -0
  30. package/dist/PhonePublish/create-task/task-list.css.d.ts +5 -0
  31. package/dist/PhonePublish/create-task/task-list.css.js +6 -0
  32. package/dist/PhonePublish/create-task/task-list.d.ts +9 -0
  33. package/dist/PhonePublish/create-task/task-list.js +323 -0
  34. package/dist/PhonePublish/index.css.d.ts +2 -0
  35. package/dist/PhonePublish/index.css.js +35 -0
  36. package/dist/PhonePublish/index.d.ts +15 -0
  37. package/dist/PhonePublish/index.js +191 -0
  38. package/dist/PhonePublish/index.less +55 -0
  39. package/dist/PhonePublish/lib/chrome-quit.d.ts +2 -0
  40. package/dist/PhonePublish/lib/chrome-quit.js +20 -0
  41. package/dist/PhonePublish/log/index.d.ts +8 -0
  42. package/dist/PhonePublish/log/index.js +186 -0
  43. package/dist/PhonePublish/log/index.less +81 -0
  44. package/dist/PhonePublish/publish-task-plan/index.d.ts +9 -0
  45. package/dist/PhonePublish/publish-task-plan/index.js +32 -0
  46. package/dist/PhonePublish/publish-task-plan/index.less +4 -0
  47. package/dist/PhonePublish/publish-task-plan/tool-bak.txt +219 -0
  48. package/dist/PhonePublish/publish-task-plan/tool.d.ts +29 -0
  49. package/dist/PhonePublish/publish-task-plan/tool.js +720 -0
  50. package/dist/PhonePublish/task-list/index.d.ts +8 -0
  51. package/dist/PhonePublish/task-list/index.js +224 -0
  52. package/dist/PhonePublish/task-list/index.less +8 -0
  53. package/dist/PhonePublish/task-list/plan/list.d.ts +12 -0
  54. package/dist/PhonePublish/task-list/plan/list.js +290 -0
  55. package/dist/PhonePublish/task-list/plan/list.less +87 -0
  56. package/dist/PhonePublish/task-list/plan/operate.d.ts +8 -0
  57. package/dist/PhonePublish/task-list/plan/operate.js +145 -0
  58. package/dist/PhonePublish/task-list/plan/query.d.ts +8 -0
  59. package/dist/PhonePublish/task-list/plan/query.js +89 -0
  60. package/dist/PhonePublish/task-list/plan/query.less +9 -0
  61. package/dist/PhonePublish/task-list/plan/status.d.ts +13 -0
  62. package/dist/PhonePublish/task-list/plan/status.js +53 -0
  63. package/dist/PhonePublish/task-list/query.d.ts +8 -0
  64. package/dist/PhonePublish/task-list/query.js +76 -0
  65. package/dist/PhonePublish/task-list/query.less +19 -0
  66. package/dist/PhonePublish/task-list/who-can-view.d.ts +12 -0
  67. package/dist/PhonePublish/task-list/who-can-view.js +37 -0
  68. package/dist/PhonePublish/video-account/ban/index.d.ts +10 -0
  69. package/dist/PhonePublish/video-account/ban/index.js +94 -0
  70. package/dist/PhonePublish/video-account/ban/index.less +4 -0
  71. package/dist/PhonePublish/video-account/base-info.d.ts +13 -0
  72. package/dist/PhonePublish/video-account/base-info.js +75 -0
  73. package/dist/PhonePublish/video-account/base-info.less +92 -0
  74. package/dist/PhonePublish/video-account/create.d.ts +8 -0
  75. package/dist/PhonePublish/video-account/create.js +174 -0
  76. package/dist/PhonePublish/video-account/group.d.ts +9 -0
  77. package/dist/PhonePublish/video-account/group.js +255 -0
  78. package/dist/PhonePublish/video-account/group.less +10 -0
  79. package/dist/PhonePublish/video-account/index.d.ts +8 -0
  80. package/dist/PhonePublish/video-account/index.js +403 -0
  81. package/dist/PhonePublish/video-account/index.less +92 -0
  82. package/dist/PhonePublish/video-account/query.d.ts +8 -0
  83. package/dist/PhonePublish/video-account/query.js +115 -0
  84. package/dist/PhonePublish/video-account/query.less +18 -0
  85. package/dist/PhonePublish/video-publish-statistic/account-trend/index.d.ts +8 -0
  86. package/dist/PhonePublish/video-publish-statistic/account-trend/index.js +173 -0
  87. package/dist/PhonePublish/video-publish-statistic/account-trend/index.less +3 -0
  88. package/dist/PhonePublish/video-publish-statistic/account-trend/kind-list.d.ts +7 -0
  89. package/dist/PhonePublish/video-publish-statistic/account-trend/kind-list.js +22 -0
  90. package/dist/PhonePublish/video-publish-statistic/account-trend/query.d.ts +9 -0
  91. package/dist/PhonePublish/video-publish-statistic/account-trend/query.js +54 -0
  92. package/dist/PhonePublish/video-publish-statistic/account-trend/query.less +3 -0
  93. package/dist/PhonePublish/video-publish-statistic/index.d.ts +2 -0
  94. package/dist/PhonePublish/video-publish-statistic/index.js +37 -0
  95. package/dist/PhonePublish/video-publish-statistic/kind.d.ts +16 -0
  96. package/dist/PhonePublish/video-publish-statistic/kind.js +57 -0
  97. package/dist/PhonePublish/video-publish-statistic/operation/list.d.ts +7 -0
  98. package/dist/PhonePublish/video-publish-statistic/operation/list.js +242 -0
  99. package/dist/PhonePublish/video-publish-statistic/operation/list.less +10 -0
  100. package/dist/PhonePublish/video-publish-statistic/operation/query.d.ts +8 -0
  101. package/dist/PhonePublish/video-publish-statistic/operation/query.js +56 -0
  102. package/dist/PhonePublish/video-publish-statistic/operation/query.less +3 -0
  103. package/dist/PhonePublish/video-publish-statistic/publish-plan/list.d.ts +8 -0
  104. package/dist/PhonePublish/video-publish-statistic/publish-plan/list.js +257 -0
  105. package/dist/PhonePublish/video-publish-statistic/publish-plan/list.less +105 -0
  106. package/dist/PhonePublish/video-publish-statistic/publish-plan/query.d.ts +9 -0
  107. package/dist/PhonePublish/video-publish-statistic/publish-plan/query.js +79 -0
  108. package/dist/PhonePublish/video-publish-statistic/publish-plan/query.less +3 -0
  109. package/dist/VideoPublish/account-manage/list.js +1 -1
  110. package/dist/index.d.ts +1 -0
  111. package/dist/index.js +1 -0
  112. package/dist/lib/Tool.d.ts +1 -1
  113. package/dist/phone/index.d.ts +8 -0
  114. package/dist/phone/index.js +62 -0
  115. package/dist/phone/index.less +170 -0
  116. package/dist/typings.d.ts +1 -1
  117. package/package.json +1 -1
@@ -0,0 +1,186 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
+ import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
3
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
4
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
5
+ import React, { useState, useEffect, useRef } from "react";
6
+ import "./index.less";
7
+ import LayoutContent from "../../UI/LayoutContent";
8
+ import dayjs from "dayjs";
9
+ import Markdown from "../../component/markdown";
10
+ import { Divider, Empty, Tag, Tooltip } from "antd";
11
+ import event from "../../lib/event";
12
+ import math from "../../lib/math";
13
+ import Time from "../../UI/Time";
14
+ import * as VideoPublishVideoAccountController from "../../service/api/VideoPublishVideoAccountController";
15
+ import notification from "../../lib/notification";
16
+ import { jsx as _jsx } from "react/jsx-runtime";
17
+ import { Fragment as _Fragment } from "react/jsx-runtime";
18
+ import { jsxs as _jsxs } from "react/jsx-runtime";
19
+ var MaxLine = 10000;
20
+ var VideoPublishLog = function VideoPublishLog(_ref) {
21
+ var _ref$clientIdentity = _ref.clientIdentity,
22
+ clientIdentity = _ref$clientIdentity === void 0 ? '' : _ref$clientIdentity,
23
+ env = _ref.env;
24
+ var _useState = useState(0),
25
+ _useState2 = _slicedToArray(_useState, 2),
26
+ logAmount = _useState2[0],
27
+ setLogAmount = _useState2[1];
28
+ var _useState3 = useState(0),
29
+ _useState4 = _slicedToArray(_useState3, 2),
30
+ lastTaskApplyTime = _useState4[0],
31
+ setLastTaskApplyTime = _useState4[1];
32
+ var textRef = useRef([
33
+ // '22 <Tag>1213132</Tag> 11 <Button type="primary">dddddd</Button>'
34
+ ]);
35
+ var _useState5 = useState([
36
+ // '<span class="created">10:01:20</span> ddddddddddd'
37
+ ]),
38
+ _useState6 = _slicedToArray(_useState5, 2),
39
+ textList = _useState6[0],
40
+ setTextList = _useState6[1];
41
+ var LogStatusDict = {
42
+ wait: '<ClockCircleOutlined class="icon icon-wait" />',
43
+ warn: '<WarningFilled class="icon icon-warn" />',
44
+ fail: '<CloseSquareFilled class="icon icon-fail" />',
45
+ success: '<CheckCircleFilled class="icon icon-success" />',
46
+ finish: '<CheckCircleFilled class="icon icon-success" />'
47
+ };
48
+ var onLogDo = function onLogDo(data) {
49
+ console.log('log data:', data);
50
+ (function () {
51
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(code) {
52
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
53
+ while (1) switch (_context.prev = _context.next) {
54
+ case 0:
55
+ _context.t0 = code;
56
+ _context.next = _context.t0 === 'not-login' ? 3 : 8;
57
+ break;
58
+ case 3:
59
+ _context.next = 5;
60
+ return VideoPublishVideoAccountController.saveLoginStatus({
61
+ clientIdentity: clientIdentity,
62
+ taskId: data.taskId,
63
+ platformVideoAccountId: data.platformAccountId,
64
+ platform: data.platform,
65
+ isLogin: false,
66
+ loginValidMessage: data.message
67
+ }, {
68
+ env: env
69
+ }).catch(function (err) {
70
+ console.log("上报登录失败", err === null || err === void 0 ? void 0 : err.message);
71
+ });
72
+ case 5:
73
+ event.run('video-publish-auth-change');
74
+ notification.notificationError('有账户未登录', /*#__PURE__*/_jsxs(_Fragment, {
75
+ children: ["\u8BF7\u68C0\u67E5 ", /*#__PURE__*/_jsx(Tag, {
76
+ children: data.nickname || ''
77
+ })]
78
+ }));
79
+ return _context.abrupt("break", 8);
80
+ case 8:
81
+ case "end":
82
+ return _context.stop();
83
+ }
84
+ }, _callee);
85
+ }));
86
+ return function (_x) {
87
+ return _ref2.apply(this, arguments);
88
+ };
89
+ })()(data === null || data === void 0 ? void 0 : data.code);
90
+ var logKey = data.logKey ? data.logKey : math.randWord(10);
91
+ var messageData = {
92
+ platform: data.platform,
93
+ platformAccountId: data.platformAccountId,
94
+ taskId: data.taskId,
95
+ id: logKey,
96
+ logStatus: data.status,
97
+ nickname: data.nickname,
98
+ content: data.message || '',
99
+ created: Date.now()
100
+ };
101
+ var index = findIndex(logKey);
102
+ if (index < 0) {
103
+ textRef.current.unshift(messageData);
104
+ } else {
105
+ // 不更新时间
106
+ textRef.current[index].content = messageData.content;
107
+ textRef.current[index].logStatus = messageData.logStatus;
108
+ }
109
+ if (textRef.current.length > MaxLine) {
110
+ // textRef.current = textRef.current.slice( textRef.current.length - MaxLine );
111
+ textRef.current = textRef.current.slice(0, MaxLine);
112
+ }
113
+ setTextList(_toConsumableArray(textRef.current));
114
+ };
115
+ var onLog = function onLog() {
116
+ event.on('task-apply', function () {
117
+ setLogAmount(function (n) {
118
+ return n + 1;
119
+ });
120
+ setLastTaskApplyTime(Math.floor(Date.now() * 0.001));
121
+ });
122
+ event.on('ws-message.publish-video-log-publish-video', function (query) {
123
+ // console.log('ws-message publish-video -log-publish-video:', query );
124
+ if (query.dataType !== 'publish-video-log-publish-video') {
125
+ return;
126
+ }
127
+ onLogDo(query.data);
128
+ });
129
+ event.on('publish-video-log-publish-video', function (query) {
130
+ onLogDo(query);
131
+ });
132
+ event.on('shipinlv-video-publish-log', function (data) {
133
+ onLogDo(data);
134
+ });
135
+ };
136
+ var findIndex = function findIndex(id) {
137
+ for (var index in textRef.current) {
138
+ var item = textRef.current[index];
139
+ if (id === item.id) {
140
+ return parseInt(index);
141
+ }
142
+ }
143
+ return -1;
144
+ };
145
+ useEffect(function () {
146
+ onLog();
147
+ return function () {};
148
+ }, []);
149
+ return /*#__PURE__*/_jsx(LayoutContent, {
150
+ title: "\u53D1\u5E03\u65E5\u5FD7",
151
+ extInfo: /*#__PURE__*/_jsxs("div", {
152
+ children: [/*#__PURE__*/_jsxs(Tooltip, {
153
+ title: "\u672C\u6B21\u8FD0\u884C\u5171\u8BF7\u6C42\u4EFB\u52A1\u6570",
154
+ children: [logAmount, " ", /*#__PURE__*/_jsx("small", {
155
+ children: "\u6B21"
156
+ })]
157
+ }), /*#__PURE__*/_jsx(Divider, {
158
+ type: "vertical"
159
+ }), lastTaskApplyTime && /*#__PURE__*/_jsx(Time, {
160
+ time: lastTaskApplyTime
161
+ })]
162
+ }),
163
+ className: "videoPublishLog",
164
+ children: /*#__PURE__*/_jsxs("div", {
165
+ className: "warp",
166
+ children: [textList.map(function (items, i) {
167
+ var logStatus = LogStatusDict[items.logStatus] || '';
168
+ var time = dayjs(items.created).format('MM-DD HH:mm:ss');
169
+ var contentText = "<span class=\"created\">".concat(time, "</span> <VideoPlatform platform=\"").concat(items.platform, "\" /> <span>").concat(items.nickname, " </span> <Tooltip title='\u4EFB\u52A1\u7F16\u53F7'><Tag color='blue'> ").concat(items.taskId, "</Tag></Tooltip> ").concat(logStatus, " <span class=\"content\">").concat(items.content, "</span>");
170
+ if (items.content === '-----') {
171
+ contentText = '<Divider />';
172
+ }
173
+ return /*#__PURE__*/_jsx("div", {
174
+ className: "line ".concat('line-' + items.logStatus),
175
+ children: /*#__PURE__*/_jsx(Markdown, {
176
+ content: contentText
177
+ })
178
+ }, "".concat(items.id, "-").concat(i));
179
+ }), textList.length === 0 && /*#__PURE__*/_jsx(Empty, {
180
+ description: "\u6682\u65E0\u64CD\u4F5C\u65E5\u5FD7",
181
+ image: Empty.PRESENTED_IMAGE_SIMPLE
182
+ })]
183
+ })
184
+ });
185
+ };
186
+ export default VideoPublishLog;
@@ -0,0 +1,81 @@
1
+ .videoPublishLog{
2
+ font-size: 13px;
3
+ .created{
4
+ margin: 0 6px 0 0;
5
+ padding: 2px 4px;
6
+ background-color: #F2F2F2;
7
+ font-weight: 300;
8
+ //opacity: 0.7;
9
+ font-size: 13px;
10
+ min-width: 95px;
11
+ text-align: center;
12
+ display: inline-block;
13
+ line-height: 1em;
14
+ border-radius: 3px;
15
+ }
16
+ .ant-progress-line{
17
+ max-width: 200px;
18
+ }
19
+
20
+ pre{
21
+ word-break: break-all;
22
+ white-space: break-spaces;
23
+
24
+ //font-size: 12px;
25
+ line-height: 1.5em;
26
+ font-weight: 300;
27
+ color: #555;
28
+ }
29
+ .warp{
30
+ height: calc(100vh - 195px);
31
+ overflow-y: auto;
32
+ }
33
+ .line, p{
34
+ margin: 4px 0 6px;
35
+ word-break: break-all;
36
+ white-space: break-spaces;
37
+ //font-size: 12px;
38
+ line-height: 1.6em;
39
+ font-weight: 400;
40
+ color: #555;
41
+ padding: 0;
42
+ &.line-fail{
43
+ :global{
44
+ .content{
45
+ color: #C00;
46
+ }
47
+ }
48
+ }
49
+ }
50
+
51
+ .anticon{
52
+ margin-right: 5px;
53
+ //vertical-align: middle;
54
+ }
55
+ .ant-tag{
56
+ padding-inline: 0 5px;
57
+ padding: 0 5px !important;
58
+ line-height: 18px !important;
59
+ }
60
+ .icon-warn{
61
+ color: #F60;
62
+ font-size: 1.05em;
63
+ }
64
+ .icon-success{
65
+ color: green;
66
+ font-size: 1.05em;
67
+ }
68
+ .icon-wait{
69
+ color: blue;
70
+ font-size: 1.05em;
71
+ }
72
+ .icon-fail{
73
+ color: #C00;
74
+ font-size: 1.05em;
75
+
76
+ }
77
+ .padVideo-Progress{
78
+ width: 200px;
79
+ }
80
+ }
81
+
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import './index.less';
3
+ interface Props {
4
+ env?: Global.Env;
5
+ disabled?: boolean;
6
+ clientIdentity: string;
7
+ }
8
+ declare const VideoPublishPublishVideoPlan: React.FC<Props>;
9
+ export default VideoPublishPublishVideoPlan;
@@ -0,0 +1,32 @@
1
+ import React, { useEffect } from 'react';
2
+ import "./index.less";
3
+ import PublishTaskPlanClass from "./tool";
4
+ import event from "../../lib/event";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ var VideoPublishPublishVideoPlan = function VideoPublishPublishVideoPlan(_ref) {
7
+ var disabled = _ref.disabled,
8
+ env = _ref.env,
9
+ _ref$clientIdentity = _ref.clientIdentity,
10
+ clientIdentity = _ref$clientIdentity === void 0 ? '' : _ref$clientIdentity;
11
+ useEffect(function () {
12
+ if (disabled) {
13
+ return;
14
+ }
15
+ var publishTaskPlan = new PublishTaskPlanClass(env || '', clientIdentity, {
16
+ // onVideoPublish: ( proxyInfo, query ) => {
17
+ // console.log('on log:', proxyInfo, query );
18
+ // // 发送给 本地服务器 SSE
19
+ // return Promise.resolve( true );
20
+ // },
21
+ onLog: function onLog(query) {
22
+ console.log('on log:', query);
23
+ event.run('publish-video', query);
24
+ }
25
+ });
26
+ publishTaskPlan.onInit();
27
+ }, []);
28
+ return /*#__PURE__*/_jsx("div", {
29
+ className: "publishVideoPlan"
30
+ });
31
+ };
32
+ export default VideoPublishPublishVideoPlan;
@@ -0,0 +1,4 @@
1
+ .publishVideo{
2
+
3
+
4
+ }
@@ -0,0 +1,219 @@
1
+ import * as VideoPublishCrawlerTaskController from '../../service/api/VideoPublishCrawlerTaskController';
2
+ import sleep from "../../lib/sleep";
3
+ import event from "../../lib/event";
4
+ import AccountManageSettingConfig from "../../lib/accountManageSettingConfig";
5
+
6
+ class PublishTaskPlanClass {
7
+ timeLoopMillisecond = 15 * 1e3;
8
+ isPublishing = false;
9
+ env = '' as Global.Env | undefined ;
10
+ clientIdentity = '';
11
+ constructor( env?: Global.Env, clientIdentity = '' ) {
12
+ this.env = env;
13
+ this.clientIdentity = clientIdentity;
14
+ }
15
+ onInit(){
16
+ setInterval(() => {
17
+ if( this.isPublishing ){
18
+ return;
19
+ }
20
+ this.getWork();
21
+ }, 2e3 );
22
+
23
+ // 桥
24
+ window.getBridge?.()?.onLog?.( ( query: any ) => {
25
+ event.run('shipinlv-video-publish-log', query )
26
+ });
27
+ }
28
+
29
+ async getWork(){
30
+ const settingConfig = AccountManageSettingConfig();
31
+ if( settingConfig.disabledApplyTask ){
32
+ return;
33
+ }
34
+
35
+ this.isPublishing = true;
36
+ const taskDetail = await this.onTaskGet()
37
+ .catch( err => {
38
+
39
+ });
40
+
41
+ if( ! taskDetail ){
42
+ await sleep( this.timeLoopMillisecond );
43
+ this.isPublishing = false;
44
+ return;
45
+ }
46
+
47
+ this.doWork( taskDetail );
48
+ }
49
+
50
+ async doWork( taskDetail: PublishTaskPlan.TaskDetail ){
51
+ if( taskDetail.emptyLoopTimeSecond > 10 ){
52
+ this.timeLoopMillisecond = taskDetail.emptyLoopTimeSecond * 1e3;
53
+ }
54
+
55
+ console.log("taskDetail;", taskDetail );
56
+ const item = taskDetail.taskInfo;
57
+ if( item.taskType === '' ){
58
+ console.log('无任务');
59
+ await this.doWorkWait();
60
+ return;
61
+ }
62
+
63
+
64
+ const saveBaseData = {
65
+ taskType: item.taskType,
66
+ taskId: item.taskId,
67
+ platform: taskDetail.platform,
68
+ platformAccountId: taskDetail.platformVideoAccountId,
69
+ };
70
+ switch ( item.taskType ) {
71
+ case "publish-video":
72
+ if( ! item.publishVideo ){
73
+ console.warn("item.publishVideo is empty!")
74
+ this.onReport(false, "publishVideo 不存在", saveBaseData );
75
+ break;
76
+ }
77
+ const result = await this.onPublishVideo(
78
+ taskDetail.platform,
79
+ taskDetail.platformVideoAccountId,
80
+ taskDetail.taskInfo,
81
+ taskDetail.proxyInfo,
82
+ )
83
+ .catch( err => {
84
+ console.warn("onPublishVideo err:", err );
85
+ this.onReport(false, err?.message, saveBaseData );
86
+ });
87
+ if( result ){
88
+ this.onReport(result.success, result.message, saveBaseData );
89
+ }
90
+ break;
91
+ default:
92
+ const errMessage = '暂不支持 类型:'+ item.taskType ;
93
+ console.log( errMessage );
94
+ const errLog: VideoPublishLog.Receive = {
95
+ platform: taskDetail.platform,
96
+ platformAccountId: taskDetail.platformVideoAccountId,
97
+ code: 'not-support-task-type',
98
+ message: errMessage,
99
+ status: 'fail',
100
+ taskId: item.taskId,
101
+ eventType: 'task-kind'
102
+ }
103
+ this.onLog( errLog );
104
+
105
+ this.onReport(false, errMessage, saveBaseData );
106
+ }
107
+
108
+ await this.doWorkWait();
109
+ }
110
+
111
+ async onLog( query: VideoPublishLog.Receive ){
112
+ event.run('shipinlv-video-publish-log', query);
113
+ }
114
+
115
+ async doWorkWait(){
116
+ await sleep( this.timeLoopMillisecond );
117
+ this.isPublishing = false;
118
+ }
119
+
120
+ onReport(success: boolean, message: string, saveBaseData: PublishTaskPlan.ReportTaskQueryBaseInfo ){
121
+ VideoPublishCrawlerTaskController.report({
122
+ success,
123
+ message,
124
+ ...saveBaseData,
125
+ },{
126
+ env: this.env,
127
+ });
128
+ }
129
+
130
+ async onTaskGet(){
131
+ event.run('task-apply');
132
+ const env = this.env;
133
+
134
+ return await VideoPublishCrawlerTaskController.apply({
135
+
136
+ }, {
137
+ env,
138
+ });
139
+ }
140
+
141
+ async onPublishVideo(
142
+ platform: Global.VideoPlatformKind,
143
+ platformVideoAccountId: string,
144
+ taskInfo: PublishTaskPlan.TaskInfo,
145
+ proxyInfo: Global.ProxyInfo,
146
+ ){
147
+ // 发布抖音视频
148
+ await sleep( 1 );
149
+ return new Promise<PublishNpm.VideoPublishResult>(async ( resolve, reject ) => {
150
+ const settingConfig = AccountManageSettingConfig();
151
+ console.log('settingConfig 1:', settingConfig );
152
+ const publishResult = await window.getBridge?.().videoPublish(
153
+ proxyInfo,
154
+ {
155
+ platformVideoAccountId,
156
+ platform,
157
+ open: settingConfig.isChromeOpen, // 发布视频的时候是否打开图形界面
158
+ taskInfo,
159
+ // taskInfo: {
160
+ // taskId: detail.taskId,
161
+ // taskType:
162
+ // publishVideo: {
163
+ // taskId: detail.taskId,
164
+ // title: detail.title, // "视频标题",
165
+ // introduction: detail.introduction, //"视频简介",
166
+ // videoKindTag: detail.videoKindTag, //"", // shopping | ""
167
+ // videoUrl: detail.videoUrl, //"视频地址",
168
+ // publishTime: detail.publishTime, //"2024-08-14 10:00", // 可以是int也可以是string
169
+ // kindTagValue: detail.kindTagValue, // "" // 抖音是商品链接 快手是商品relItemId
170
+ // }
171
+ // },
172
+ })
173
+ .catch( err => {
174
+ // 基本不会到这里
175
+ console.warn('bridge. video Publish err:', err.code, err );
176
+ resolve( err );
177
+ });
178
+
179
+ if( ! publishResult ){
180
+ return publishResult;
181
+ }
182
+
183
+ console.log("publishResult:", publishResult);
184
+
185
+ if( ! publishResult.success ){
186
+ const errLog: VideoPublishLog.Receive = {
187
+ platform: publishResult.data.platform,
188
+ platformAccountId: publishResult.data.platformVideoAccountId,
189
+ code: publishResult.code,
190
+ message: publishResult.message,
191
+ status: 'fail',
192
+ taskId: taskInfo.taskId,
193
+ eventType: 'publish-video'
194
+ }
195
+ // event.run('lo g', errLog);
196
+ this.onLog( errLog );
197
+
198
+ const err = new Error( publishResult.message );
199
+ err.name = publishResult.code;
200
+ return reject( err );
201
+ }
202
+
203
+ resolve( publishResult );
204
+
205
+ // const logReceive: Log.Receive = {
206
+ // platform: publishResult.data.platform,
207
+ // platformAccountId: publishResult.data.platformVideoAccountId,
208
+ // code: 'publish-video-finish',
209
+ // message: '',
210
+ // status: 'success',
211
+ // taskId: 0,
212
+ // eventType: 'task-kind'
213
+ // }
214
+ // event.run('lo g', logReceive);
215
+ });
216
+ }
217
+ }
218
+
219
+ export default PublishTaskPlanClass;
@@ -0,0 +1,29 @@
1
+ declare class PublishTaskPlanClass {
2
+ timeLoopMillisecond: number;
3
+ isPublishing: boolean;
4
+ env: Global.Env | '';
5
+ clientIdentity: string;
6
+ lastPublishHeart: number;
7
+ MaxNotHeartSecond: number;
8
+ taskDetail: PublishTaskPlan.TaskDetail;
9
+ options: PublishTaskPlan.Options;
10
+ constructor(env: Global.Env | '', clientIdentity: string | undefined, options: PublishTaskPlan.Options);
11
+ onInit(): void;
12
+ getWork(): Promise<void>;
13
+ doWork(taskDetail: PublishTaskPlan.TaskDetail): Promise<void>;
14
+ onLog(query: VideoPublishLog.Receive): Promise<void>;
15
+ doWorkWait(): Promise<void>;
16
+ onReport(success: boolean, code: string, // not-login
17
+ message: string, saveBaseData: PublishTaskPlan.ReportTaskQueryBaseInfo): Promise<boolean>;
18
+ onTaskGet(): Promise<PublishTaskPlan.TaskDetail>;
19
+ onPublishVideo(platform: Global.VideoPlatformKind, platformVideoAccountId: string, nickname: string, chromeProfileName: string, taskInfo: PublishTaskPlan.TaskInfo, proxyInfo: Global.ProxyInfo): Promise<boolean>;
20
+ onPublishVideoDo(proxyInfo: Global.ProxyInfo, query: {
21
+ platformVideoAccountId: string;
22
+ platform: Global.VideoPlatformKind;
23
+ nickname: string;
24
+ open: boolean;
25
+ chromeProfileName: string;
26
+ taskInfo: PublishTaskPlan.TaskInfo;
27
+ }, settingConfig: VideoPublishAccountManageSetting.Config): Promise<boolean>;
28
+ }
29
+ export default PublishTaskPlanClass;