@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.
package/dist/index.mjs CHANGED
@@ -2980,7 +2980,7 @@ async function handleToutiaoData(params) {
2980
2980
  }
2981
2981
  async function handleWeixinData(params) {
2982
2982
  try {
2983
- const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
2983
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
2984
2984
  if (!token) return {
2985
2985
  code: 200,
2986
2986
  message: "缺少token",
@@ -3059,9 +3059,11 @@ async function handleWeixinData(params) {
3059
3059
  }
3060
3060
  });
3061
3061
  }
3062
- let size = pageSize > 20 ? 20 : pageSize;
3063
- let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
3062
+ let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
3063
+ let begin = (lastPage ?? pageNum) - 1;
3064
+ let rawArticlesInfo = await fetchArticles(begin * size, size, token);
3064
3065
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
3066
+ let articleCell = [];
3065
3067
  if (!onlySuccess && pageSize > 20) {
3066
3068
  let totalFetched = articlesInfo.publish_list.length;
3067
3069
  let nextPage = pageNum + 1;
@@ -3075,29 +3077,70 @@ async function handleWeixinData(params) {
3075
3077
  if (parsed.publish_list.length < currentPageSize) break;
3076
3078
  nextPage++;
3077
3079
  }
3080
+ articleCell = articlesInfo.publish_list.map((item)=>({
3081
+ title: item.publish_info.appmsg_info[0].title,
3082
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3083
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3084
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3085
+ readNum: item.publish_info.appmsg_info[0].read_num,
3086
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3087
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3088
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3089
+ ...showOriginalData ? {
3090
+ originalData: item
3091
+ } : {}
3092
+ }));
3078
3093
  }
3079
- const articleCell = articlesInfo?.publish_list.map((item)=>({
3080
- title: item.publish_info.appmsg_info[0].title,
3081
- imageUrl: item.publish_info.appmsg_info[0].cover,
3082
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3083
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
3084
- readNum: item.publish_info.appmsg_info[0].read_num,
3085
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
3086
- shareNum: item.publish_info.appmsg_info[0].share_num,
3087
- recommendNum: item.publish_info.appmsg_info[0].like_num,
3088
- ...showOriginalData ? {
3089
- originalData: item
3090
- } : {}
3091
- }));
3092
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3093
- articleCell,
3094
- ...onlySuccess ? {
3094
+ let nextPage = false;
3095
+ if (onlySuccess) {
3096
+ let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3097
+ if (cursor) {
3098
+ const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
3099
+ if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
3100
+ }
3101
+ let totalFetched = filteredList.length;
3102
+ while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
3103
+ begin += 1;
3104
+ let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
3105
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3106
+ const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3107
+ filteredList = filteredList.concat(newFiltered);
3108
+ totalFetched = filteredList.length;
3109
+ }
3110
+ filteredList = filteredList.slice(0, pageSize);
3111
+ totalFetched = filteredList.length;
3112
+ if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
3113
+ let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
3114
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3115
+ nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
3116
+ }
3117
+ const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
3118
+ articleCell = filteredList.map((item)=>({
3119
+ title: item.appmsg_info[0].title,
3120
+ imageUrl: item.appmsg_info[0].cover,
3121
+ createTime: item.appmsg_info[0].line_info.send_time,
3122
+ redirectUrl: item.appmsg_info[0].content_url,
3123
+ readNum: item.appmsg_info[0].read_num,
3124
+ likeNum: item.appmsg_info[0].old_like_num,
3125
+ shareNum: item.appmsg_info[0].share_num,
3126
+ recommendNum: item.appmsg_info[0].like_num,
3127
+ ...showOriginalData ? {
3128
+ originalData: item
3129
+ } : {}
3130
+ }));
3131
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3132
+ articleCell,
3095
3133
  pagination: {
3096
- total: articlesInfo?.total_count,
3134
+ nextPage,
3097
3135
  pageNum,
3098
- pageSize
3136
+ pageSize,
3137
+ lastPage: begin + 1,
3138
+ cursor: lastMsgId
3099
3139
  }
3100
- } : null
3140
+ }, "微信文章文章获取成功");
3141
+ }
3142
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3143
+ articleCell
3101
3144
  }, "微信文章文章获取成功");
3102
3145
  } catch (error) {
3103
3146
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -3154,11 +3197,11 @@ async function handleBaijiahaoData(params) {
3154
3197
  imageUrl: JSON.parse(item.cover_images)[0].src,
3155
3198
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3156
3199
  redirectUrl: item.url,
3157
- recommendNum: item.rec_amount,
3200
+ recommendNum: item.rec_amount | item.forward_num,
3158
3201
  collectNum: item.collection_amount,
3159
- readNum: item.read_amount,
3160
- likeNum: item.like_amount,
3161
- commentNum: item.comment_amount,
3202
+ readNum: item.read_amount | item.read_num,
3203
+ likeNum: item.like_amount | item.praise_num,
3204
+ commentNum: item.comment_amount | item.comment_num,
3162
3205
  shareNum: item.share_amount,
3163
3206
  ...showOriginalData ? {
3164
3207
  originalData: item
@@ -5261,7 +5304,7 @@ const xiaohongshuPublish = async (task, params)=>{
5261
5304
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5262
5305
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5263
5306
  };
5264
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.1"}');
5307
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.2"}');
5265
5308
  class Action {
5266
5309
  constructor(task){
5267
5310
  this.task = task;