@iflyrpa/actions 1.2.14-beta.4 → 1.2.14-beta.6

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
@@ -3029,18 +3029,36 @@ async function handleWeixinData(params) {
3029
3029
  };
3030
3030
  return finalData;
3031
3031
  };
3032
- const rawArticlesInfo = await http.api({
3033
- method: "get",
3034
- url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
3035
- params: {
3036
- sub: "list",
3037
- begin: (pageNum - 1) * pageSize,
3038
- count: pageSize,
3039
- token: token,
3040
- lang: "zh_CN"
3032
+ async function fetchArticles(begin, pageSize, token) {
3033
+ return http.api({
3034
+ method: "get",
3035
+ url: 'https://mp.weixin.qq.com/cgi-bin/appmsgpublish',
3036
+ params: {
3037
+ sub: "list",
3038
+ begin: begin,
3039
+ count: pageSize,
3040
+ token: token,
3041
+ lang: "zh_CN"
3042
+ }
3043
+ });
3044
+ }
3045
+ let size = pageSize > 20 ? 20 : pageSize;
3046
+ let rawArticlesInfo = await fetchArticles((pageNum - 1) * size, size, token);
3047
+ let articlesInfo = ParsePublishPage(rawArticlesInfo);
3048
+ if (!onlySuccess && pageSize > 20) {
3049
+ let totalFetched = articlesInfo.publish_list.length;
3050
+ let nextPage = pageNum + 1;
3051
+ while(totalFetched < pageSize){
3052
+ const remaining = pageSize - totalFetched;
3053
+ const currentPageSize = remaining > 20 ? 20 : remaining;
3054
+ let _rawArticlesInfo = await fetchArticles((nextPage - 1) * 20, currentPageSize, token);
3055
+ let parsed = ParsePublishPage(_rawArticlesInfo);
3056
+ articlesInfo.publish_list = articlesInfo.publish_list.concat(parsed.publish_list);
3057
+ totalFetched = articlesInfo.publish_list.length;
3058
+ if (parsed.publish_list.length < currentPageSize) break;
3059
+ nextPage++;
3041
3060
  }
3042
- });
3043
- const articlesInfo = ParsePublishPage(rawArticlesInfo);
3061
+ }
3044
3062
  const articleCell = articlesInfo?.publish_list.map((item)=>({
3045
3063
  title: item.publish_info.appmsg_info[0].title,
3046
3064
  imageUrl: item.publish_info.appmsg_info[0].cover,
@@ -5195,7 +5213,7 @@ const xiaohongshuPublish = async (task, params)=>{
5195
5213
  if ("mockApi" === params.actionType) return xiaohongshuPublish_mock_mockAction(task, params);
5196
5214
  return executeAction(xiaohongshuPublish_mock_mockAction, xiaohongshuPublish_rpa_rpaAction)(task, params);
5197
5215
  };
5198
- var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.3"}');
5216
+ var package_namespaceObject = JSON.parse('{"i8":"1.2.14-beta.5"}');
5199
5217
  class Action {
5200
5218
  constructor(task){
5201
5219
  this.task = task;