@iflyrpa/actions 1.2.16-beta.1 → 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
@@ -2772,16 +2772,17 @@ async function getToutiaoData(params) {
2772
2772
  }
2773
2773
  })
2774
2774
  ]);
2775
+ const isReday = void 0 !== totalData.data.statistic.data.yesterday_read_count;
2775
2776
  const ttData = {
2776
2777
  fansNum: Number(totalData.data.statistic.data.total_subscribe_count),
2777
2778
  fansNumYesterday: void 0 !== totalData.data.statistic.data.yesterday_fans ? Number(totalData.data.statistic.data.yesterday_fans) : null,
2778
2779
  readNum: Number(totalData.data.statistic.data.total_read_play_count),
2779
2780
  incomeNum: totalData.data.statistic.data.total_income,
2780
2781
  incomeNumYesterday: totalData.data.statistic.data.is_yesterday_income_ready ? totalData.data.statistic.data.yesterday_income : null,
2781
- showNumYesterday: contentDataYesterday.author_stat.consume_data.impression_count,
2782
- readNumYesterday: contentDataYesterday.author_stat.consume_data.go_detail_count,
2783
- likeNumYesterday: contentDataYesterday.author_stat.interaction_data.digg_count,
2784
- commentNumYesterday: contentDataYesterday.author_stat.interaction_data.comment_count
2782
+ showNumYesterday: isReday ? contentDataYesterday.author_stat.consume_data.impression_count : null,
2783
+ readNumYesterday: isReday ? contentDataYesterday.author_stat.consume_data.go_detail_count : null,
2784
+ likeNumYesterday: isReday ? contentDataYesterday.author_stat.interaction_data.digg_count : null,
2785
+ commentNumYesterday: isReday ? contentDataYesterday.author_stat.interaction_data.comment_count : null
2785
2786
  };
2786
2787
  return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)(ttData, "头条号粉丝数据获取成功!");
2787
2788
  } catch (error) {
@@ -2979,7 +2980,7 @@ async function handleToutiaoData(params) {
2979
2980
  }
2980
2981
  async function handleWeixinData(params) {
2981
2982
  try {
2982
- 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;
2983
2984
  if (!token) return {
2984
2985
  code: 200,
2985
2986
  message: "缺少token",
@@ -3058,9 +3059,11 @@ async function handleWeixinData(params) {
3058
3059
  }
3059
3060
  });
3060
3061
  }
3061
- let size = pageSize > 20 ? 20 : pageSize;
3062
- 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);
3063
3065
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
3066
+ let articleCell = [];
3064
3067
  if (!onlySuccess && pageSize > 20) {
3065
3068
  let totalFetched = articlesInfo.publish_list.length;
3066
3069
  let nextPage = pageNum + 1;
@@ -3074,29 +3077,70 @@ async function handleWeixinData(params) {
3074
3077
  if (parsed.publish_list.length < currentPageSize) break;
3075
3078
  nextPage++;
3076
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
+ }));
3077
3093
  }
3078
- const articleCell = articlesInfo?.publish_list.map((item)=>({
3079
- title: item.publish_info.appmsg_info[0].title,
3080
- imageUrl: item.publish_info.appmsg_info[0].cover,
3081
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3082
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
3083
- readNum: item.publish_info.appmsg_info[0].read_num,
3084
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
3085
- shareNum: item.publish_info.appmsg_info[0].share_num,
3086
- recommendNum: item.publish_info.appmsg_info[0].like_num,
3087
- ...showOriginalData ? {
3088
- originalData: item
3089
- } : {}
3090
- }));
3091
- return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3092
- articleCell,
3093
- ...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,
3094
3133
  pagination: {
3095
- total: articlesInfo?.total_count,
3134
+ nextPage,
3096
3135
  pageNum,
3097
- pageSize
3136
+ pageSize,
3137
+ lastPage: begin + 1,
3138
+ cursor: lastMsgId
3098
3139
  }
3099
- } : null
3140
+ }, "微信文章文章获取成功");
3141
+ }
3142
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3143
+ articleCell
3100
3144
  }, "微信文章文章获取成功");
3101
3145
  } catch (error) {
3102
3146
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -3153,11 +3197,11 @@ async function handleBaijiahaoData(params) {
3153
3197
  imageUrl: JSON.parse(item.cover_images)[0].src,
3154
3198
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3155
3199
  redirectUrl: item.url,
3156
- recommendNum: item.rec_amount,
3200
+ recommendNum: item.rec_amount | item.forward_num,
3157
3201
  collectNum: item.collection_amount,
3158
- readNum: item.read_amount,
3159
- likeNum: item.like_amount,
3160
- 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,
3161
3205
  shareNum: item.share_amount,
3162
3206
  ...showOriginalData ? {
3163
3207
  originalData: item
@@ -5260,7 +5304,7 @@ const xiaohongshuPublish = async (task, params)=>{
5260
5304
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5261
5305
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5262
5306
  };
5263
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.0"}');
5307
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.2"}');
5264
5308
  class Action {
5265
5309
  constructor(task){
5266
5310
  this.task = task;