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

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
@@ -1124,12 +1124,7 @@ class Http {
1124
1124
  }
1125
1125
  constructor(config){
1126
1126
  this.apiClient = __WEBPACK_EXTERNAL_MODULE_axios__["default"].create({
1127
- ...config,
1128
- proxy: {
1129
- host: "localhost",
1130
- port: 9000,
1131
- protocol: "http"
1132
- }
1127
+ ...config
1133
1128
  });
1134
1129
  }
1135
1130
  addResponseInterceptor(findError) {
@@ -2980,7 +2975,7 @@ async function handleToutiaoData(params) {
2980
2975
  }
2981
2976
  async function handleWeixinData(params) {
2982
2977
  try {
2983
- const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
2978
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
2984
2979
  if (!token) return {
2985
2980
  code: 200,
2986
2981
  message: "缺少token",
@@ -3059,9 +3054,11 @@ async function handleWeixinData(params) {
3059
3054
  }
3060
3055
  });
3061
3056
  }
3062
- let size = pageSize > 20 ? 20 : pageSize;
3063
- let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
3057
+ let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
3058
+ let begin = (lastPage ?? pageNum) - 1;
3059
+ let rawArticlesInfo = await fetchArticles(begin * size, size, token);
3064
3060
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
3061
+ let articleCell = [];
3065
3062
  if (!onlySuccess && pageSize > 20) {
3066
3063
  let totalFetched = articlesInfo.publish_list.length;
3067
3064
  let nextPage = pageNum + 1;
@@ -3075,29 +3072,70 @@ async function handleWeixinData(params) {
3075
3072
  if (parsed.publish_list.length < currentPageSize) break;
3076
3073
  nextPage++;
3077
3074
  }
3075
+ articleCell = articlesInfo.publish_list.map((item)=>({
3076
+ title: item.publish_info.appmsg_info[0].title,
3077
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3078
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3079
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3080
+ readNum: item.publish_info.appmsg_info[0].read_num,
3081
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3082
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3083
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3084
+ ...showOriginalData ? {
3085
+ originalData: item
3086
+ } : {}
3087
+ }));
3078
3088
  }
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 ? {
3089
+ let nextPage = false;
3090
+ if (onlySuccess) {
3091
+ let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3092
+ if (cursor) {
3093
+ const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
3094
+ if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
3095
+ }
3096
+ let totalFetched = filteredList.length;
3097
+ while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
3098
+ begin += 1;
3099
+ let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
3100
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3101
+ const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3102
+ filteredList = filteredList.concat(newFiltered);
3103
+ totalFetched = filteredList.length;
3104
+ }
3105
+ filteredList = filteredList.slice(0, pageSize);
3106
+ totalFetched = filteredList.length;
3107
+ if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
3108
+ let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
3109
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3110
+ nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
3111
+ }
3112
+ const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
3113
+ articleCell = filteredList.map((item)=>({
3114
+ title: item.appmsg_info[0].title,
3115
+ imageUrl: item.appmsg_info[0].cover,
3116
+ createTime: item.appmsg_info[0].line_info.send_time,
3117
+ redirectUrl: item.appmsg_info[0].content_url,
3118
+ readNum: item.appmsg_info[0].read_num,
3119
+ likeNum: item.appmsg_info[0].old_like_num,
3120
+ shareNum: item.appmsg_info[0].share_num,
3121
+ recommendNum: item.appmsg_info[0].like_num,
3122
+ ...showOriginalData ? {
3123
+ originalData: item
3124
+ } : {}
3125
+ }));
3126
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3127
+ articleCell,
3095
3128
  pagination: {
3096
- total: articlesInfo?.total_count,
3129
+ nextPage,
3097
3130
  pageNum,
3098
- pageSize
3131
+ pageSize,
3132
+ lastPage: begin + 1,
3133
+ cursor: lastMsgId
3099
3134
  }
3100
- } : null
3135
+ }, "微信文章文章获取成功");
3136
+ }
3137
+ return (0, __WEBPACK_EXTERNAL_MODULE__iflyrpa_share_f7afdc8c__.success)({
3138
+ articleCell
3101
3139
  }, "微信文章文章获取成功");
3102
3140
  } catch (error) {
3103
3141
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -3154,11 +3192,11 @@ async function handleBaijiahaoData(params) {
3154
3192
  imageUrl: JSON.parse(item.cover_images)[0].src,
3155
3193
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3156
3194
  redirectUrl: item.url,
3157
- recommendNum: item.rec_amount,
3195
+ recommendNum: item.rec_amount | item.forward_num,
3158
3196
  collectNum: item.collection_amount,
3159
- readNum: item.read_amount,
3160
- likeNum: item.like_amount,
3161
- commentNum: item.comment_amount,
3197
+ readNum: item.read_amount | item.read_num,
3198
+ likeNum: item.like_amount | item.praise_num,
3199
+ commentNum: item.comment_amount | item.comment_num,
3162
3200
  shareNum: item.share_amount,
3163
3201
  ...showOriginalData ? {
3164
3202
  originalData: item
@@ -5261,7 +5299,7 @@ const xiaohongshuPublish = async (task, params)=>{
5261
5299
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5262
5300
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5263
5301
  };
5264
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.1"}');
5302
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.3"}');
5265
5303
  class Action {
5266
5304
  constructor(task){
5267
5305
  this.task = task;