@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.js CHANGED
@@ -3031,7 +3031,7 @@ var __webpack_exports__ = {};
3031
3031
  }
3032
3032
  async function handleWeixinData(params) {
3033
3033
  try {
3034
- const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false } = params;
3034
+ const { cookies, token, pageNum = 1, pageSize = 10, showOriginalData = false, onlySuccess = false, cursor, lastPage } = params;
3035
3035
  if (!token) return {
3036
3036
  code: 200,
3037
3037
  message: "缺少token",
@@ -3110,9 +3110,11 @@ var __webpack_exports__ = {};
3110
3110
  }
3111
3111
  });
3112
3112
  }
3113
- let size = pageSize > 20 ? 20 : pageSize;
3114
- let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
3113
+ let size = onlySuccess ? 10 : pageSize > 20 ? 20 : pageSize;
3114
+ let begin = (lastPage ?? pageNum) - 1;
3115
+ let rawArticlesInfo = await fetchArticles(begin * size, size, token);
3115
3116
  let articlesInfo = ParsePublishPage(rawArticlesInfo);
3117
+ let articleCell = [];
3116
3118
  if (!onlySuccess && pageSize > 20) {
3117
3119
  let totalFetched = articlesInfo.publish_list.length;
3118
3120
  let nextPage = pageNum + 1;
@@ -3126,29 +3128,70 @@ var __webpack_exports__ = {};
3126
3128
  if (parsed.publish_list.length < currentPageSize) break;
3127
3129
  nextPage++;
3128
3130
  }
3131
+ articleCell = articlesInfo.publish_list.map((item)=>({
3132
+ title: item.publish_info.appmsg_info[0].title,
3133
+ imageUrl: item.publish_info.appmsg_info[0].cover,
3134
+ createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3135
+ redirectUrl: item.publish_info.appmsg_info[0].content_url,
3136
+ readNum: item.publish_info.appmsg_info[0].read_num,
3137
+ likeNum: item.publish_info.appmsg_info[0].old_like_num,
3138
+ shareNum: item.publish_info.appmsg_info[0].share_num,
3139
+ recommendNum: item.publish_info.appmsg_info[0].like_num,
3140
+ ...showOriginalData ? {
3141
+ originalData: item
3142
+ } : {}
3143
+ }));
3129
3144
  }
3130
- const articleCell = articlesInfo?.publish_list.map((item)=>({
3131
- title: item.publish_info.appmsg_info[0].title,
3132
- imageUrl: item.publish_info.appmsg_info[0].cover,
3133
- createTime: item.publish_info.appmsg_info[0].line_info.send_time,
3134
- redirectUrl: item.publish_info.appmsg_info[0].content_url,
3135
- readNum: item.publish_info.appmsg_info[0].read_num,
3136
- likeNum: item.publish_info.appmsg_info[0].old_like_num,
3137
- shareNum: item.publish_info.appmsg_info[0].share_num,
3138
- recommendNum: item.publish_info.appmsg_info[0].like_num,
3139
- ...showOriginalData ? {
3140
- originalData: item
3141
- } : {}
3142
- }));
3143
- return (0, share_namespaceObject.success)({
3144
- articleCell,
3145
- ...onlySuccess ? {
3145
+ let nextPage = false;
3146
+ if (onlySuccess) {
3147
+ let filteredList = articlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3148
+ if (cursor) {
3149
+ const cursorIndex = filteredList.findIndex((item)=>item.msgid === cursor);
3150
+ if (-1 !== cursorIndex) filteredList = filteredList.slice(cursorIndex + 1);
3151
+ }
3152
+ let totalFetched = filteredList.length;
3153
+ while(totalFetched < pageSize && begin * size < articlesInfo.total_count){
3154
+ begin += 1;
3155
+ let nextRawArticlesInfo = await fetchArticles(begin * size, size, token);
3156
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3157
+ const newFiltered = nextArticlesInfo.publish_list.filter((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey")).map((item)=>item.publish_info);
3158
+ filteredList = filteredList.concat(newFiltered);
3159
+ totalFetched = filteredList.length;
3160
+ }
3161
+ filteredList = filteredList.slice(0, pageSize);
3162
+ totalFetched = filteredList.length;
3163
+ if (totalFetched >= pageSize && begin * size < articlesInfo.total_count) {
3164
+ let nextRawArticlesInfo = await fetchArticles((begin + 1) * size, size, token);
3165
+ let nextArticlesInfo = ParsePublishPage(nextRawArticlesInfo);
3166
+ nextPage = nextArticlesInfo.publish_list.length > 0 && nextArticlesInfo.publish_list.some((item)=>-1 == item.publish_info.appmsg_info[0].content_url.indexOf("tempkey"));
3167
+ }
3168
+ const lastMsgId = filteredList.length > 0 ? filteredList[filteredList.length - 1].msgid : void 0;
3169
+ articleCell = filteredList.map((item)=>({
3170
+ title: item.appmsg_info[0].title,
3171
+ imageUrl: item.appmsg_info[0].cover,
3172
+ createTime: item.appmsg_info[0].line_info.send_time,
3173
+ redirectUrl: item.appmsg_info[0].content_url,
3174
+ readNum: item.appmsg_info[0].read_num,
3175
+ likeNum: item.appmsg_info[0].old_like_num,
3176
+ shareNum: item.appmsg_info[0].share_num,
3177
+ recommendNum: item.appmsg_info[0].like_num,
3178
+ ...showOriginalData ? {
3179
+ originalData: item
3180
+ } : {}
3181
+ }));
3182
+ return (0, share_namespaceObject.success)({
3183
+ articleCell,
3146
3184
  pagination: {
3147
- total: articlesInfo?.total_count,
3185
+ nextPage,
3148
3186
  pageNum,
3149
- pageSize
3187
+ pageSize,
3188
+ lastPage: begin + 1,
3189
+ cursor: lastMsgId
3150
3190
  }
3151
- } : null
3191
+ }, "微信文章文章获取成功");
3192
+ }
3193
+ return (0, share_namespaceObject.success)({
3194
+ articleCell
3152
3195
  }, "微信文章文章获取成功");
3153
3196
  } catch (error) {
3154
3197
  return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "微信文章数据获取失败");
@@ -3205,11 +3248,11 @@ var __webpack_exports__ = {};
3205
3248
  imageUrl: JSON.parse(item.cover_images)[0].src,
3206
3249
  createTime: Math.floor(new Date(item.publish_at.replace(/-/g, "/")).getTime() / 1000),
3207
3250
  redirectUrl: item.url,
3208
- recommendNum: item.rec_amount,
3251
+ recommendNum: item.rec_amount | item.forward_num,
3209
3252
  collectNum: item.collection_amount,
3210
- readNum: item.read_amount,
3211
- likeNum: item.like_amount,
3212
- commentNum: item.comment_amount,
3253
+ readNum: item.read_amount | item.read_num,
3254
+ likeNum: item.like_amount | item.praise_num,
3255
+ commentNum: item.comment_amount | item.comment_num,
3213
3256
  shareNum: item.share_amount,
3214
3257
  ...showOriginalData ? {
3215
3258
  originalData: item
@@ -5312,7 +5355,7 @@ var __webpack_exports__ = {};
5312
5355
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5313
5356
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5314
5357
  };
5315
- var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.1"}');
5358
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.16-beta.2"}');
5316
5359
  class Action {
5317
5360
  constructor(task){
5318
5361
  this.task = task;