@iflyrpa/actions 4.0.4-beta.3 → 4.0.4-beta.5

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/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6b7b33da-d2a4-5623-b09a-756a2fe8a917")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="f29f1122-4d79-5247-a4f3-3314fc4310ad")}catch(e){}}();
3
3
  var __webpack_modules__ = {
4
4
  "./src/utils/XhsXsCommonEnc.js": function(module) {
5
5
  var encrypt_lookup = [
@@ -4402,7 +4402,7 @@ var __webpack_exports__ = {};
4402
4402
  });
4403
4403
  const package_json_namespaceObject = require("@iflyrpa/share/package.json");
4404
4404
  var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
4405
- var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.3"}');
4405
+ var package_namespaceObject = JSON.parse('{"i8":"4.0.4-beta.5"}');
4406
4406
  const share_namespaceObject = require("@iflyrpa/share");
4407
4407
  const external_node_fs_namespaceObject = require("node:fs");
4408
4408
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
@@ -13799,7 +13799,7 @@ var __webpack_exports__ = {};
13799
13799
  error: message,
13800
13800
  result: {
13801
13801
  ...safeDecision,
13802
- data: safeDecision,
13802
+ data: decision,
13803
13803
  uploadedImgList: JSON.stringify(publishData.item.common.images)
13804
13804
  }
13805
13805
  };
@@ -15456,8 +15456,6 @@ var __webpack_exports__ = {};
15456
15456
  userProfileP,
15457
15457
  overviewP
15458
15458
  ]);
15459
- _task.logger.info(`抖音用户信息响应: ${JSON.stringify(userProfile)}`);
15460
- _task.logger.info(`抖音近7日数据响应: ${JSON.stringify(overview)}`);
15461
15459
  let fansNum = 0;
15462
15460
  let favedNum = 0;
15463
15461
  let followingNum = 0;
@@ -15472,12 +15470,12 @@ var __webpack_exports__ = {};
15472
15470
  const douyinData = {
15473
15471
  fansNum,
15474
15472
  favedNum,
15475
- fansNumLastWeek: toNum(ov?.fans_incr?.current_count),
15476
- watchNumLastWeek: toNum(ov?.play_count?.current_count),
15477
- likeNumLastWeek: toNum(ov?.like_count?.current_count),
15478
- commentNumLastWeek: toNum(ov?.comment_count?.current_count),
15479
- shareNumLastWeek: toNum(ov?.share_count?.current_count),
15480
- visitNumLastWeek: toNum(ov?.profile_visit?.current_count)
15473
+ fansNumLastWeek: toNum(ov?.new_fans?.last_period_incr),
15474
+ watchNumLastWeek: toNum(ov?.play?.last_period_incr),
15475
+ likeNumLastWeek: toNum(ov?.digg?.last_period_incr),
15476
+ commentNumLastWeek: toNum(ov?.comment?.last_period_incr),
15477
+ shareNumLastWeek: toNum(ov?.share?.last_period_incr),
15478
+ visitNumLastWeek: toNum(ov?.profile?.last_period_incr)
15481
15479
  };
15482
15480
  return (0, share_namespaceObject.success)(douyinData, "抖音平台数据获取成功!");
15483
15481
  } catch (error) {
@@ -15541,7 +15539,6 @@ var __webpack_exports__ = {};
15541
15539
  retryDelay: 100,
15542
15540
  timeout: 5000
15543
15541
  });
15544
- _task.logger.info(`视频号账号数据响应: ${JSON.stringify(authData)}`);
15545
15542
  const AUTH_ERROR_CODES = [
15546
15543
  300333,
15547
15544
  300334,
@@ -15558,13 +15555,60 @@ var __webpack_exports__ = {};
15558
15555
  return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
15559
15556
  }
15560
15557
  const finderUser = authData.data?.finderUser;
15558
+ const now = new Date();
15559
+ const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 2);
15560
+ const startTs = Math.floor(yesterday.getTime() / 1000);
15561
+ const endTs = startTs + 86400;
15562
+ _task.logger.info(`视频号昨日数据范围 start: ${startTs} ~ end: ${endTs}`);
15563
+ let fansNumYesterday = 0;
15564
+ let playNumYesterday = 0;
15565
+ let likeNumYesterday = 0;
15566
+ let commentNumYesterday = 0;
15567
+ try {
15568
+ const statsData = await http.api({
15569
+ method: "post",
15570
+ url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/statistic/new_post_total_data",
15571
+ params: {
15572
+ _aid: aid,
15573
+ _rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
15574
+ _pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
15575
+ },
15576
+ data: {
15577
+ startTs: startTs.toString(),
15578
+ endTs: endTs.toString(),
15579
+ interval: 3,
15580
+ timestamp: Date.now().toString(),
15581
+ _log_finder_uin: "",
15582
+ _log_finder_id: finderId,
15583
+ rawKeyBuff: "",
15584
+ pluginSessionId: null,
15585
+ scene: 7,
15586
+ reqScene: 7
15587
+ }
15588
+ }, {
15589
+ retries: 3,
15590
+ retryDelay: 100,
15591
+ timeout: 5000
15592
+ });
15593
+ if (!statsData.errCode && statsData.data?.totalData) {
15594
+ const data = statsData.data.totalData;
15595
+ fansNumYesterday = Number.parseInt(data.follow?.[1] || "0", 10) || 0;
15596
+ playNumYesterday = Number.parseInt(data.browse?.[1] || "0", 10) || 0;
15597
+ likeNumYesterday = Number.parseInt(data.like?.[1] || "0", 10) || 0;
15598
+ commentNumYesterday = Number.parseInt(data.comment?.[1] || "0", 10) || 0;
15599
+ _task.logger.info(`视频号昨日数据提取成功 - 净增关注:${fansNumYesterday}, 播放:${playNumYesterday}, 喜欢:${likeNumYesterday}, 评论:${commentNumYesterday}`);
15600
+ }
15601
+ } catch (error) {
15602
+ const errMsg = error instanceof Error ? error.message : String(error);
15603
+ _task.logger.warn(`视频号昨日数据获取失败(降级为null): ${errMsg}`);
15604
+ }
15561
15605
  const shipinhaoData = {
15562
15606
  fansNum: finderUser?.fansCount || 0,
15563
15607
  feedsCount: finderUser?.feedsCount || 0,
15564
- fansNumYesterday: null,
15565
- playNumYesterday: null,
15566
- likeNumYesterday: null,
15567
- commentNumYesterday: null
15608
+ fansNumYesterday,
15609
+ playNumYesterday,
15610
+ likeNumYesterday,
15611
+ commentNumYesterday
15568
15612
  };
15569
15613
  return (0, share_namespaceObject.success)(shipinhaoData, "视频号平台数据获取成功!");
15570
15614
  } catch (error) {
@@ -16021,7 +16065,8 @@ var __webpack_exports__ = {};
16021
16065
  }
16022
16066
  async function handleDouyinData(_task, params) {
16023
16067
  try {
16024
- const { cookies, pageNum = 1, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
16068
+ const { cookies, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
16069
+ const pageNum = params.pageNum || 1;
16025
16070
  const headers = {
16026
16071
  cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
16027
16072
  referer: "https://creator.douyin.com"
@@ -16116,7 +16161,8 @@ var __webpack_exports__ = {};
16116
16161
  }
16117
16162
  async function handleShipinhaoData(_task, params) {
16118
16163
  try {
16119
- const { cookies, postType = "all", pageNum = 1, pageSize = 20, showOriginalData = false } = params;
16164
+ const { cookies, postType = "all", pageSize = 10, showOriginalData = false } = params;
16165
+ const pageNum = params.pageNum || 1;
16120
16166
  const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
16121
16167
  const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
16122
16168
  const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
@@ -16142,7 +16188,7 @@ var __webpack_exports__ = {};
16142
16188
  ];
16143
16189
  const http = new Http(...args);
16144
16190
  const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
16145
- async function fetchPosts(currentPage, userpageType, pageUrl) {
16191
+ async function fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff = "") {
16146
16192
  return await http.api({
16147
16193
  method: "post",
16148
16194
  url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
@@ -16159,7 +16205,7 @@ var __webpack_exports__ = {};
16159
16205
  timestamp: Date.now().toString(),
16160
16206
  _log_finder_uin: "",
16161
16207
  _log_finder_id: finderIdCookie,
16162
- rawKeyBuff: "",
16208
+ rawKeyBuff,
16163
16209
  pluginSessionId: null,
16164
16210
  scene: 7,
16165
16211
  reqScene: 7
@@ -16170,6 +16216,37 @@ var __webpack_exports__ = {};
16170
16216
  timeout: 5000
16171
16217
  });
16172
16218
  }
16219
+ async function fetchAllPosts(userpageType, pageUrl) {
16220
+ const allPosts = [];
16221
+ let currentPage = 1;
16222
+ let rawKeyBuff = "";
16223
+ let continueFlag = true;
16224
+ let totalCount = 0;
16225
+ while(continueFlag){
16226
+ const response = await fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff);
16227
+ if (response.errCode && AUTH_ERROR_CODES.includes(response.errCode)) throw new Error(`AUTH_ERROR:${response.errMsg || "登录已失效"}`);
16228
+ if (response.errCode) {
16229
+ _task.logger.warn(`视频号API错误:${response.errMsg} (${response.errCode})`);
16230
+ throw new Error(`视频号API错误:${response.errMsg} (${response.errCode})`);
16231
+ }
16232
+ if (1 === currentPage) totalCount = response.data?.totalCount ?? 0;
16233
+ const posts = response.data?.list || response.posts || response.post_list || [];
16234
+ allPosts.push(...posts);
16235
+ continueFlag = response.data?.continueFlag ?? false;
16236
+ rawKeyBuff = response.data?.lastBuff || "";
16237
+ _task.logger.info(`获取${11 === userpageType ? "视频" : "图文"}第${currentPage}页,本页${posts.length}条,累计${allPosts.length}条,continueFlag=${continueFlag}`);
16238
+ currentPage++;
16239
+ if (currentPage > 100) {
16240
+ _task.logger.warn("分页超过100页,停止请求");
16241
+ break;
16242
+ }
16243
+ }
16244
+ if (totalCount > 0 && allPosts.length !== totalCount) _task.logger.warn(`视频号分页可能不完整:期望${totalCount}条,实际${allPosts.length}条`);
16245
+ return {
16246
+ posts: allPosts,
16247
+ totalCount
16248
+ };
16249
+ }
16173
16250
  const mapPost = (item, forcePostType)=>{
16174
16251
  let imageUrl = "";
16175
16252
  if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
@@ -16205,21 +16282,14 @@ var __webpack_exports__ = {};
16205
16282
  300331,
16206
16283
  300332
16207
16284
  ];
16285
+ let combinedTotal = 0;
16208
16286
  if (needVideo) try {
16209
16287
  const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
16210
- const videoResponse = await fetchPosts(pageNum, 11, videoPageUrl);
16211
- _task.logger.info(`视频号视频获取响应:${JSON.stringify(videoResponse)}`);
16212
- if (videoResponse.errCode && AUTH_ERROR_CODES.includes(videoResponse.errCode)) throw new Error(`AUTH_ERROR:${videoResponse.errMsg || "登录已失效"}`);
16213
- if (videoResponse.errCode) {
16214
- _task.logger.warn(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
16215
- throw new Error(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
16216
- }
16217
- {
16218
- const posts = videoResponse.data?.list || videoResponse.posts || videoResponse.post_list || [];
16219
- const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
16220
- allArticles.push(...videoArticles);
16221
- _task.logger.info(`视频号视频获取成功,共${videoArticles.length}条`);
16222
- }
16288
+ const { posts, totalCount } = await fetchAllPosts(11, videoPageUrl);
16289
+ _task.logger.info(`视频号视频获取响应:共${posts.length}条,totalCount=${totalCount}`);
16290
+ const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
16291
+ allArticles.push(...videoArticles);
16292
+ combinedTotal += totalCount || videoArticles.length;
16223
16293
  } catch (error) {
16224
16294
  const errMsg = error instanceof Error ? error.message : String(error);
16225
16295
  if (errMsg.startsWith("AUTH_ERROR:")) throw error;
@@ -16227,30 +16297,26 @@ var __webpack_exports__ = {};
16227
16297
  }
16228
16298
  if (needArticle) try {
16229
16299
  const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
16230
- const articleResponse = await fetchPosts(pageNum, 10, articlePageUrl);
16231
- if (articleResponse.errCode && AUTH_ERROR_CODES.includes(articleResponse.errCode)) throw new Error(`AUTH_ERROR:${articleResponse.errMsg || "登录已失效"}`);
16232
- if (articleResponse.errCode) {
16233
- _task.logger.warn(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
16234
- throw new Error(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
16235
- }
16236
- {
16237
- const posts = articleResponse.data?.list || articleResponse.posts || articleResponse.post_list || [];
16238
- const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
16239
- allArticles.push(...articleArticles);
16240
- _task.logger.info(`视频号图文获取成功,共${articleArticles.length}条`);
16241
- }
16300
+ const { posts, totalCount } = await fetchAllPosts(10, articlePageUrl);
16301
+ _task.logger.info(`视频号图文获取响应:共${posts.length}条,totalCount=${totalCount}`);
16302
+ const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
16303
+ allArticles.push(...articleArticles);
16304
+ combinedTotal += totalCount || articleArticles.length;
16242
16305
  } catch (error) {
16243
16306
  const errMsg = error instanceof Error ? error.message : String(error);
16244
16307
  if (errMsg.startsWith("AUTH_ERROR:")) throw error;
16245
16308
  _task.logger.warn(`获取视频号图文失败:${errMsg}`);
16246
16309
  }
16247
16310
  allArticles.sort((a, b)=>b.createTime - a.createTime);
16248
- _task.logger.info(`视频号数据获取成功,${JSON.stringify(allArticles)}`);
16311
+ const total = allArticles.length;
16312
+ const start = (pageNum - 1) * pageSize;
16313
+ const pageItems = allArticles.slice(start, start + pageSize);
16314
+ _task.logger.info(`视频号数据获取成功,合计${total}条,第${pageNum}页返回${pageItems.length}条`);
16249
16315
  return (0, share_namespaceObject.success)({
16250
- articleCell: allArticles,
16316
+ articleCell: pageItems,
16251
16317
  pagination: {
16252
- total: allArticles.length,
16253
- nextPage: false,
16318
+ total,
16319
+ nextPage: start + pageSize < total,
16254
16320
  pageNum,
16255
16321
  pageSize
16256
16322
  }
@@ -25610,4 +25676,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
25610
25676
  });
25611
25677
 
25612
25678
  //# sourceMappingURL=index.js.map
25613
- //# debugId=6b7b33da-d2a4-5623-b09a-756a2fe8a917
25679
+ //# debugId=f29f1122-4d79-5247-a4f3-3314fc4310ad