@iflyrpa/actions 1.2.16-beta.2 → 1.2.16-beta.3

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.
@@ -9,5 +9,7 @@ export interface FetchArticlesParams extends ActiomCommonParams {
9
9
  size?: number;
10
10
  onlySuccess?: boolean;
11
11
  showOriginalData?: boolean;
12
+ cursor?: number;
13
+ lastPage?: number;
12
14
  }
13
15
  export declare const FetchArticles: CommonAction<FetchArticlesParams, FetchArticlesData | null>;
@@ -37,6 +37,8 @@ export interface FetchArticlesData {
37
37
  pagination?: {
38
38
  total?: number;
39
39
  nextPage?: boolean;
40
+ lastPage?: number;
41
+ cursor?: number;
40
42
  pageNum: number;
41
43
  pageSize: number;
42
44
  };
package/dist/bundle.js CHANGED
@@ -15906,7 +15906,7 @@ var __webpack_exports__ = {};
15906
15906
  }
15907
15907
  async function handleWeixinData(params) {
15908
15908
  try {
15909
- const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
15909
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
15910
15910
  if (!token) return {
15911
15911
  code: 200,
15912
15912
  message: "缺少token",
@@ -15985,9 +15985,11 @@ var __webpack_exports__ = {};
15985
15985
  }
15986
15986
  });
15987
15987
  }
15988
- let size = pageSize > 20 ? 20 : pageSize;
15989
- let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
15988
+ let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
15989
+ let begin = (lastPage ?? pageNum) - 1;
15990
+ let rawArticlesInfo = await fetchArticles(begin * size, size, token);
15990
15991
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
15992
+ let articleCell = [];
15991
15993
  if (!onlySuccess && pageSize > 20) {
15992
15994
  let totalFetched = articlesInfo.publish_list.length;
15993
15995
  let nextPage = pageNum + 1;
@@ -16001,29 +16003,70 @@ var __webpack_exports__ = {};
16001
16003
  if (parsed.publish_list.length < currentPageSize) break;
16002
16004
  nextPage++;
16003
16005
  }
16006
+ articleCell = articlesInfo.publish_list.map((item)=>({
16007
+ title: item.publish_info.appmsg_info[0].title,
16008
+ imageUrl: item.publish_info.appmsg_info[0].cover,
16009
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
16010
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
16011
+ readNum: item.publish_info.appmsg_info[0].read_num,
16012
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
16013
+ shareNum: item.publish_info.appmsg_info[0].share_num,
16014
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
16015
+ ...showOriginalData ? {
16016
+ originalData: item
16017
+ } : {}
16018
+ }));
16004
16019
  }
16005
- const articleCell = articlesInfo?.publish_list.map((item)=>({
16006
- title: item.publish_info.appmsg_info[0].title,
16007
- imageUrl: item.publish_info.appmsg_info[0].cover,
16008
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
16009
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
16010
- readNum: item.publish_info.appmsg_info[0].read_num,
16011
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
16012
- shareNum: item.publish_info.appmsg_info[0].share_num,
16013
- recommendNum: item.publish_info.appmsg_info[0].like_num,
16014
- ...showOriginalData ? {
16015
- originalData: item
16016
- } : {}
16017
- }));
16018
- return success({
16019
- articleCell,
16020
- ...onlySuccess ? {
16020
+ let nextPage = false;
16021
+ if (onlySuccess) {
16022
+ let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
16023
+ if (cursor) {
16024
+ const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
16025
+ if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
16026
+ }
16027
+ let totalFetched = filteredList.length;
16028
+ while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
16029
+ begin += 1;
16030
+ let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
16031
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
16032
+ const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
16033
+ filteredList = filteredList.concat(newFiltered);
16034
+ totalFetched = filteredList.length;
16035
+ }
16036
+ filteredList = filteredList.slice(0, pageSize);
16037
+ totalFetched = filteredList.length;
16038
+ if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
16039
+ let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
16040
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
16041
+ nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
16042
+ }
16043
+ const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
16044
+ articleCell = filteredList.map((item)=>({
16045
+ title: item.appmsg_info[0].title,
16046
+ imageUrl: item.appmsg_info[0].cover,
16047
+ createTime: item.appmsg_info[0].line_info.send_time,
16048
+ redirectUrl: item.appmsg_info[0].content_url,
16049
+ readNum: item.appmsg_info[0].read_num,
16050
+ likeNum: item.appmsg_info[0].old_like_num,
16051
+ shareNum: item.appmsg_info[0].share_num,
16052
+ recommendNum: item.appmsg_info[0].like_num,
16053
+ ...showOriginalData ? {
16054
+ originalData: item
16055
+ } : {}
16056
+ }));
16057
+ return success({
16058
+ articleCell,
16021
16059
  pagination: {
16022
- total: articlesInfo?.total_count,
16060
+ nextPage,
16023
16061
  pageNum,
16024
- pageSize
16062
+ pageSize,
16063
+ lastPage: begin + 1,
16064
+ cursor: lastMsgId
16025
16065
  }
16026
- } : null
16066
+ }, "微信文章文章获取成功");
16067
+ }
16068
+ return success({
16069
+ articleCell
16027
16070
  }, "微信文章文章获取成功");
16028
16071
  } catch (error) {
16029
16072
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -16080,11 +16123,11 @@ var __webpack_exports__ = {};
16080
16123
  imageUrl: JSON.parse(item.cover_images)[0].src,
16081
16124
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
16082
16125
  redirectUrl: item.url,
16083
- recommendNum: item.rec_amount,
16126
+ recommendNum: item.rec_amount | item.forward_num,
16084
16127
  collectNum: item.collection_amount,
16085
- readNum: item.read_amount,
16086
- likeNum: item.like_amount,
16087
- commentNum: item.comment_amount,
16128
+ readNum: item.read_amount | item.read_num,
16129
+ likeNum: item.like_amount | item.praise_num,
16130
+ commentNum: item.comment_amount | item.comment_num,
16088
16131
  shareNum: item.share_amount,
16089
16132
  ...showOriginalData ? {
16090
16133
  originalData: item
@@ -18187,7 +18230,7 @@ var __webpack_exports__ = {};
18187
18230
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
18188
18231
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
18189
18232
  };
18190
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.1"}');
18233
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.2"}');
18191
18234
  class Action {
18192
18235
  constructor(task){
18193
18236
  this.task = task;