@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/bundle.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
2
 
3
- !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]="029aefb0-580d-5097-84ee-1a7045670fcb")}catch(e){}}();
3
+ !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]="02f852b8-8ea2-52b0-ae8a-9884ff70f64a")}catch(e){}}();
4
4
  var __webpack_modules__ = {
5
5
  "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
6
6
  "use strict";
@@ -12492,7 +12492,7 @@ var __webpack_exports__ = {};
12492
12492
  var package_namespaceObject = {
12493
12493
  i8: "0.1.2"
12494
12494
  };
12495
- var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.4-beta.3"}');
12495
+ var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.4-beta.5"}');
12496
12496
  const external_node_fs_namespaceObject = require("node:fs");
12497
12497
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
12498
12498
  const external_node_http_namespaceObject = require("node:http");
@@ -38870,7 +38870,7 @@ var __webpack_exports__ = {};
38870
38870
  error: message,
38871
38871
  result: {
38872
38872
  ...safeDecision,
38873
- data: safeDecision,
38873
+ data: decision,
38874
38874
  uploadedImgList: JSON.stringify(publishData.item.common.images)
38875
38875
  }
38876
38876
  };
@@ -40527,8 +40527,6 @@ var __webpack_exports__ = {};
40527
40527
  userProfileP,
40528
40528
  overviewP
40529
40529
  ]);
40530
- _task.logger.info(`抖音用户信息响应: ${JSON.stringify(userProfile)}`);
40531
- _task.logger.info(`抖音近7日数据响应: ${JSON.stringify(overview)}`);
40532
40530
  let fansNum = 0;
40533
40531
  let favedNum = 0;
40534
40532
  let followingNum = 0;
@@ -40543,12 +40541,12 @@ var __webpack_exports__ = {};
40543
40541
  const douyinData = {
40544
40542
  fansNum,
40545
40543
  favedNum,
40546
- fansNumLastWeek: toNum(ov?.fans_incr?.current_count),
40547
- watchNumLastWeek: toNum(ov?.play_count?.current_count),
40548
- likeNumLastWeek: toNum(ov?.like_count?.current_count),
40549
- commentNumLastWeek: toNum(ov?.comment_count?.current_count),
40550
- shareNumLastWeek: toNum(ov?.share_count?.current_count),
40551
- visitNumLastWeek: toNum(ov?.profile_visit?.current_count)
40544
+ fansNumLastWeek: toNum(ov?.new_fans?.last_period_incr),
40545
+ watchNumLastWeek: toNum(ov?.play?.last_period_incr),
40546
+ likeNumLastWeek: toNum(ov?.digg?.last_period_incr),
40547
+ commentNumLastWeek: toNum(ov?.comment?.last_period_incr),
40548
+ shareNumLastWeek: toNum(ov?.share?.last_period_incr),
40549
+ visitNumLastWeek: toNum(ov?.profile?.last_period_incr)
40552
40550
  };
40553
40551
  return success(douyinData, "抖音平台数据获取成功!");
40554
40552
  } catch (error) {
@@ -40612,7 +40610,6 @@ var __webpack_exports__ = {};
40612
40610
  retryDelay: 100,
40613
40611
  timeout: 5000
40614
40612
  });
40615
- _task.logger.info(`视频号账号数据响应: ${JSON.stringify(authData)}`);
40616
40613
  const AUTH_ERROR_CODES = [
40617
40614
  300333,
40618
40615
  300334,
@@ -40629,13 +40626,60 @@ var __webpack_exports__ = {};
40629
40626
  return types_errorResponse(`视频号账号信息获取失败:${authData.errMsg || "未知错误"}`, 414);
40630
40627
  }
40631
40628
  const finderUser = authData.data?.finderUser;
40629
+ const now = new Date();
40630
+ const yesterday = new Date(now.getFullYear(), now.getMonth(), now.getDate() - 2);
40631
+ const startTs = Math.floor(yesterday.getTime() / 1000);
40632
+ const endTs = startTs + 86400;
40633
+ _task.logger.info(`视频号昨日数据范围 start: ${startTs} ~ end: ${endTs}`);
40634
+ let fansNumYesterday = 0;
40635
+ let playNumYesterday = 0;
40636
+ let likeNumYesterday = 0;
40637
+ let commentNumYesterday = 0;
40638
+ try {
40639
+ const statsData = await http.api({
40640
+ method: "post",
40641
+ url: "https://channels.weixin.qq.com/cgi-bin/mmfinderassistant-bin/statistic/new_post_total_data",
40642
+ params: {
40643
+ _aid: aid,
40644
+ _rid: `${Date.now().toString(16)}-${Math.random().toString(36).substring(2, 9)}`,
40645
+ _pageUrl: encodeURIComponent("https://channels.weixin.qq.com/platform")
40646
+ },
40647
+ data: {
40648
+ startTs: startTs.toString(),
40649
+ endTs: endTs.toString(),
40650
+ interval: 3,
40651
+ timestamp: Date.now().toString(),
40652
+ _log_finder_uin: "",
40653
+ _log_finder_id: finderId,
40654
+ rawKeyBuff: "",
40655
+ pluginSessionId: null,
40656
+ scene: 7,
40657
+ reqScene: 7
40658
+ }
40659
+ }, {
40660
+ retries: 3,
40661
+ retryDelay: 100,
40662
+ timeout: 5000
40663
+ });
40664
+ if (!statsData.errCode && statsData.data?.totalData) {
40665
+ const data = statsData.data.totalData;
40666
+ fansNumYesterday = Number.parseInt(data.follow?.[1] || "0", 10) || 0;
40667
+ playNumYesterday = Number.parseInt(data.browse?.[1] || "0", 10) || 0;
40668
+ likeNumYesterday = Number.parseInt(data.like?.[1] || "0", 10) || 0;
40669
+ commentNumYesterday = Number.parseInt(data.comment?.[1] || "0", 10) || 0;
40670
+ _task.logger.info(`视频号昨日数据提取成功 - 净增关注:${fansNumYesterday}, 播放:${playNumYesterday}, 喜欢:${likeNumYesterday}, 评论:${commentNumYesterday}`);
40671
+ }
40672
+ } catch (error) {
40673
+ const errMsg = error instanceof Error ? error.message : String(error);
40674
+ _task.logger.warn(`视频号昨日数据获取失败(降级为null): ${errMsg}`);
40675
+ }
40632
40676
  const shipinhaoData = {
40633
40677
  fansNum: finderUser?.fansCount || 0,
40634
40678
  feedsCount: finderUser?.feedsCount || 0,
40635
- fansNumYesterday: null,
40636
- playNumYesterday: null,
40637
- likeNumYesterday: null,
40638
- commentNumYesterday: null
40679
+ fansNumYesterday,
40680
+ playNumYesterday,
40681
+ likeNumYesterday,
40682
+ commentNumYesterday
40639
40683
  };
40640
40684
  return success(shipinhaoData, "视频号平台数据获取成功!");
40641
40685
  } catch (error) {
@@ -41092,7 +41136,8 @@ var __webpack_exports__ = {};
41092
41136
  }
41093
41137
  async function handleDouyinData(_task, params) {
41094
41138
  try {
41095
- const { cookies, pageNum = 1, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
41139
+ const { cookies, pageSize = 12, status = 0, showOriginalData = false, onlySuccess = false } = params;
41140
+ const pageNum = params.pageNum || 1;
41096
41141
  const headers = {
41097
41142
  cookie: cookies.map((it)=>`${it.name}=${it.value}`).join(";"),
41098
41143
  referer: "https://creator.douyin.com"
@@ -41187,7 +41232,8 @@ var __webpack_exports__ = {};
41187
41232
  }
41188
41233
  async function handleShipinhaoData(_task, params) {
41189
41234
  try {
41190
- const { cookies, postType = "all", pageNum = 1, pageSize = 20, showOriginalData = false } = params;
41235
+ const { cookies, postType = "all", pageSize = 10, showOriginalData = false } = params;
41236
+ const pageNum = params.pageNum || 1;
41191
41237
  const aidCookie = cookies.find((it)=>"_aid" === it.name)?.value;
41192
41238
  const aid = aidCookie || "9d3e0e9f-b842-498d-a273-4285d58df264";
41193
41239
  const uinCookie = cookies.find((it)=>"uin" === it.name || "wxuin" === it.name)?.value || "0000000000";
@@ -41213,7 +41259,7 @@ var __webpack_exports__ = {};
41213
41259
  ];
41214
41260
  const http = new Http(...args);
41215
41261
  const finderIdCookie = cookies.find((it)=>"_log_finder_id" === it.name || "finder_id" === it.name)?.value || "";
41216
- async function fetchPosts(currentPage, userpageType, pageUrl) {
41262
+ async function fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff = "") {
41217
41263
  return await http.api({
41218
41264
  method: "post",
41219
41265
  url: "https://channels.weixin.qq.com/micro/content/cgi-bin/mmfinderassistant-bin/post/post_list",
@@ -41230,7 +41276,7 @@ var __webpack_exports__ = {};
41230
41276
  timestamp: Date.now().toString(),
41231
41277
  _log_finder_uin: "",
41232
41278
  _log_finder_id: finderIdCookie,
41233
- rawKeyBuff: "",
41279
+ rawKeyBuff,
41234
41280
  pluginSessionId: null,
41235
41281
  scene: 7,
41236
41282
  reqScene: 7
@@ -41241,6 +41287,37 @@ var __webpack_exports__ = {};
41241
41287
  timeout: 5000
41242
41288
  });
41243
41289
  }
41290
+ async function fetchAllPosts(userpageType, pageUrl) {
41291
+ const allPosts = [];
41292
+ let currentPage = 1;
41293
+ let rawKeyBuff = "";
41294
+ let continueFlag = true;
41295
+ let totalCount = 0;
41296
+ while(continueFlag){
41297
+ const response = await fetchPosts(currentPage, userpageType, pageUrl, rawKeyBuff);
41298
+ if (response.errCode && AUTH_ERROR_CODES.includes(response.errCode)) throw new Error(`AUTH_ERROR:${response.errMsg || "登录已失效"}`);
41299
+ if (response.errCode) {
41300
+ _task.logger.warn(`视频号API错误:${response.errMsg} (${response.errCode})`);
41301
+ throw new Error(`视频号API错误:${response.errMsg} (${response.errCode})`);
41302
+ }
41303
+ if (1 === currentPage) totalCount = response.data?.totalCount ?? 0;
41304
+ const posts = response.data?.list || response.posts || response.post_list || [];
41305
+ allPosts.push(...posts);
41306
+ continueFlag = response.data?.continueFlag ?? false;
41307
+ rawKeyBuff = response.data?.lastBuff || "";
41308
+ _task.logger.info(`获取${11 === userpageType ? "视频" : "图文"}第${currentPage}页,本页${posts.length}条,累计${allPosts.length}条,continueFlag=${continueFlag}`);
41309
+ currentPage++;
41310
+ if (currentPage > 100) {
41311
+ _task.logger.warn("分页超过100页,停止请求");
41312
+ break;
41313
+ }
41314
+ }
41315
+ if (totalCount > 0 && allPosts.length !== totalCount) _task.logger.warn(`视频号分页可能不完整:期望${totalCount}条,实际${allPosts.length}条`);
41316
+ return {
41317
+ posts: allPosts,
41318
+ totalCount
41319
+ };
41320
+ }
41244
41321
  const mapPost = (item, forcePostType)=>{
41245
41322
  let imageUrl = "";
41246
41323
  if (item.desc?.media?.[0]?.thumbUrl) imageUrl = item.desc.media[0].thumbUrl;
@@ -41276,21 +41353,14 @@ var __webpack_exports__ = {};
41276
41353
  300331,
41277
41354
  300332
41278
41355
  ];
41356
+ let combinedTotal = 0;
41279
41357
  if (needVideo) try {
41280
41358
  const videoPageUrl = "https://channels.weixin.qq.com/micro/content/post/list";
41281
- const videoResponse = await fetchPosts(pageNum, 11, videoPageUrl);
41282
- _task.logger.info(`视频号视频获取响应:${JSON.stringify(videoResponse)}`);
41283
- if (videoResponse.errCode && AUTH_ERROR_CODES.includes(videoResponse.errCode)) throw new Error(`AUTH_ERROR:${videoResponse.errMsg || "登录已失效"}`);
41284
- if (videoResponse.errCode) {
41285
- _task.logger.warn(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
41286
- throw new Error(`视频号API错误:${videoResponse.errMsg} (${videoResponse.errCode})`);
41287
- }
41288
- {
41289
- const posts = videoResponse.data?.list || videoResponse.posts || videoResponse.post_list || [];
41290
- const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
41291
- allArticles.push(...videoArticles);
41292
- _task.logger.info(`视频号视频获取成功,共${videoArticles.length}条`);
41293
- }
41359
+ const { posts, totalCount } = await fetchAllPosts(11, videoPageUrl);
41360
+ _task.logger.info(`视频号视频获取响应:共${posts.length}条,totalCount=${totalCount}`);
41361
+ const videoArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "video"));
41362
+ allArticles.push(...videoArticles);
41363
+ combinedTotal += totalCount || videoArticles.length;
41294
41364
  } catch (error) {
41295
41365
  const errMsg = error instanceof Error ? error.message : String(error);
41296
41366
  if (errMsg.startsWith("AUTH_ERROR:")) throw error;
@@ -41298,30 +41368,26 @@ var __webpack_exports__ = {};
41298
41368
  }
41299
41369
  if (needArticle) try {
41300
41370
  const articlePageUrl = "https://channels.weixin.qq.com/micro/content/post/finderNewLifePostList";
41301
- const articleResponse = await fetchPosts(pageNum, 10, articlePageUrl);
41302
- if (articleResponse.errCode && AUTH_ERROR_CODES.includes(articleResponse.errCode)) throw new Error(`AUTH_ERROR:${articleResponse.errMsg || "登录已失效"}`);
41303
- if (articleResponse.errCode) {
41304
- _task.logger.warn(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
41305
- throw new Error(`视频号图文API错误:${articleResponse.errMsg} (${articleResponse.errCode})`);
41306
- }
41307
- {
41308
- const posts = articleResponse.data?.list || articleResponse.posts || articleResponse.post_list || [];
41309
- const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
41310
- allArticles.push(...articleArticles);
41311
- _task.logger.info(`视频号图文获取成功,共${articleArticles.length}条`);
41312
- }
41371
+ const { posts, totalCount } = await fetchAllPosts(10, articlePageUrl);
41372
+ _task.logger.info(`视频号图文获取响应:共${posts.length}条,totalCount=${totalCount}`);
41373
+ const articleArticles = posts.filter((item)=>item.createTime || item.create_time).map((item)=>mapPost(item, "article"));
41374
+ allArticles.push(...articleArticles);
41375
+ combinedTotal += totalCount || articleArticles.length;
41313
41376
  } catch (error) {
41314
41377
  const errMsg = error instanceof Error ? error.message : String(error);
41315
41378
  if (errMsg.startsWith("AUTH_ERROR:")) throw error;
41316
41379
  _task.logger.warn(`获取视频号图文失败:${errMsg}`);
41317
41380
  }
41318
41381
  allArticles.sort((a, b)=>b.createTime - a.createTime);
41319
- _task.logger.info(`视频号数据获取成功,${JSON.stringify(allArticles)}`);
41382
+ const total = allArticles.length;
41383
+ const start = (pageNum - 1) * pageSize;
41384
+ const pageItems = allArticles.slice(start, start + pageSize);
41385
+ _task.logger.info(`视频号数据获取成功,合计${total}条,第${pageNum}页返回${pageItems.length}条`);
41320
41386
  return success({
41321
- articleCell: allArticles,
41387
+ articleCell: pageItems,
41322
41388
  pagination: {
41323
- total: allArticles.length,
41324
- nextPage: false,
41389
+ total,
41390
+ nextPage: start + pageSize < total,
41325
41391
  pageNum,
41326
41392
  pageSize
41327
41393
  }
@@ -50681,4 +50747,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
50681
50747
  });
50682
50748
 
50683
50749
  //# sourceMappingURL=bundle.js.map
50684
- //# debugId=029aefb0-580d-5097-84ee-1a7045670fcb
50750
+ //# debugId=02f852b8-8ea2-52b0-ae8a-9884ff70f64a