@iflyrpa/actions 4.0.8 → 4.0.9-beta.1

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.
@@ -48,9 +48,9 @@ export declare const FetchArticlesParamsSchema: z.ZodObject<{
48
48
  status: z.ZodOptional<z.ZodNumber>;
49
49
  includeAccount: z.ZodOptional<z.ZodBoolean>;
50
50
  postType: z.ZodOptional<z.ZodEnum<{
51
+ all: "all";
51
52
  article: "article";
52
53
  video: "video";
53
- all: "all";
54
54
  }>>;
55
55
  }, z.core.$strip>;
56
56
  export type FetchArticlesParams = z.infer<typeof FetchArticlesParamsSchema>;
package/dist/bundle.js CHANGED
@@ -1,6 +1,4 @@
1
1
  /*! For license information please see bundle.js.LICENSE.txt */
2
-
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="5ecc4d57-e612-5298-a097-3acb08559a65")}catch(e){}}();
4
2
  var __webpack_modules__ = {
5
3
  "../../node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js": function(__unused_webpack_module, exports1, __webpack_require__) {
6
4
  "use strict";
@@ -12492,9 +12490,7 @@ var __webpack_exports__ = {};
12492
12490
  var package_namespaceObject = {
12493
12491
  i8: "0.1.2"
12494
12492
  };
12495
- var package_namespaceObject_0 = {
12496
- i8: "4.0.8"
12497
- };
12493
+ var package_namespaceObject_0 = JSON.parse('{"i8":"4.0.9-beta.1"}');
12498
12494
  const external_node_fs_namespaceObject = require("node:fs");
12499
12495
  var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
12500
12496
  const external_node_http_namespaceObject = require("node:http");
@@ -12940,7 +12936,7 @@ var __webpack_exports__ = {};
12940
12936
  Number.MAX_VALUE
12941
12937
  ]
12942
12938
  };
12943
- function pick(schema, mask) {
12939
+ function dist_pick(schema, mask) {
12944
12940
  const currDef = schema._zod.def;
12945
12941
  const def = mergeDefs(schema._zod.def, {
12946
12942
  get shape () {
@@ -15794,7 +15790,7 @@ var __webpack_exports__ = {};
15794
15790
  inst.extend = (incoming)=>extend(inst, incoming);
15795
15791
  inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
15796
15792
  inst.merge = (other)=>dist_merge(inst, other);
15797
- inst.pick = (mask)=>pick(inst, mask);
15793
+ inst.pick = (mask)=>dist_pick(inst, mask);
15798
15794
  inst.omit = (mask)=>omit(inst, mask);
15799
15795
  inst.partial = (...args)=>dist_partial(ZodOptional, inst, args[0]);
15800
15796
  inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
@@ -27041,6 +27037,124 @@ var __webpack_exports__ = {};
27041
27037
  axios.HttpStatusCode = helpers_HttpStatusCode;
27042
27038
  axios.default = axios;
27043
27039
  const lib_axios = axios;
27040
+ const USER_MESSAGE = {
27041
+ PROXY_UNAVAILABLE: "代理暂时不可用,请稍后重试或使用本地IP",
27042
+ NETWORK_ERROR: "网络异常,请稍后重试",
27043
+ SYSTEM_ERROR: "系统异常,请稍后重试或联系客服",
27044
+ PUBLISH_NETWORK: "发布失败,网络不稳定,请稍后重试",
27045
+ DOUYIN_ACCOUNT_FETCH_FAILED: "抖音数据获取失败,请稍后重试",
27046
+ SHIPINHAO_ACCOUNT_FETCH_FAILED: "视频号数据获取失败,请稍后重试",
27047
+ DOUYIN_POST_FETCH_FAILED: "抖音作品数据获取失败,请稍后重试",
27048
+ SHIPINHAO_POST_FETCH_FAILED: "视频号作品数据获取失败,请稍后重试",
27049
+ BJH_POST_FETCH_FAILED: "百家号作品数据获取失败,请稍后重试",
27050
+ TT_POST_FETCH_FAILED: "头条号作品数据获取失败,请稍后重试",
27051
+ QRCODE_FETCH_FAILED: "认证二维码获取失败,请稍后重试",
27052
+ IMAGE_UPLOAD_FAILED: "图片上传失败,请稍后重试或联系客服"
27053
+ };
27054
+ const NETWORK_CODES = [
27055
+ 500,
27056
+ 502,
27057
+ 503,
27058
+ 504
27059
+ ];
27060
+ function classifyPublishError(handledError) {
27061
+ const { code } = handledError;
27062
+ const isProxyRequest = handledError.extra?.isProxyRequest === true;
27063
+ if (!NETWORK_CODES.includes(code) && 599 !== code) return null;
27064
+ const category = 599 === code || isProxyRequest ? "代理错误" : "网络错误";
27065
+ return {
27066
+ category,
27067
+ userMessage: USER_MESSAGE.PUBLISH_NETWORK
27068
+ };
27069
+ }
27070
+ const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
27071
+ const ALARM_THROTTLE_MS = 60000;
27072
+ const lastSentAt = new Map();
27073
+ const postFeishuWebhook = (webhookUrl, payload)=>lib_axios.post(webhookUrl, payload, {
27074
+ headers: {
27075
+ "Content-Type": "application/json"
27076
+ },
27077
+ timeout: 10000
27078
+ });
27079
+ const buildFeishuPostMessage = (report)=>{
27080
+ const content = [
27081
+ [
27082
+ {
27083
+ tag: "text",
27084
+ text: `平台:${report.platform || "未知平台"}`
27085
+ }
27086
+ ],
27087
+ [
27088
+ {
27089
+ tag: "text",
27090
+ text: `错误信息:${report.msg || "未知错误信息"}`
27091
+ }
27092
+ ],
27093
+ [
27094
+ {
27095
+ tag: "text",
27096
+ text: `错误类型:${report.errorType || "未知错误类型"}`
27097
+ }
27098
+ ],
27099
+ [
27100
+ {
27101
+ tag: "text",
27102
+ text: `阶段:${report.stage || "未知阶段"}`
27103
+ }
27104
+ ],
27105
+ [
27106
+ {
27107
+ tag: "text",
27108
+ text: `等级:${report.level}`
27109
+ }
27110
+ ],
27111
+ [
27112
+ {
27113
+ tag: "text",
27114
+ text: `来源:${report.source}`
27115
+ }
27116
+ ]
27117
+ ];
27118
+ if (void 0 !== report.code && null !== report.code) content.push([
27119
+ {
27120
+ tag: "text",
27121
+ text: `接口错误码:${report.code}`
27122
+ }
27123
+ ]);
27124
+ if (report.url) content.push([
27125
+ {
27126
+ tag: "text",
27127
+ text: `地址:${report.url}`
27128
+ }
27129
+ ]);
27130
+ if ("alarm" === report.level) content.push([
27131
+ {
27132
+ tag: "at",
27133
+ user_id: "all"
27134
+ }
27135
+ ]);
27136
+ return {
27137
+ msg_type: "post",
27138
+ content: {
27139
+ post: {
27140
+ zh_cn: {
27141
+ title: report.title || "RPA异常",
27142
+ content
27143
+ }
27144
+ }
27145
+ }
27146
+ };
27147
+ };
27148
+ const reportFeishuAlarm = (report)=>{
27149
+ try {
27150
+ const key = `${report.platform}|${report.source}|${report.errorType}|${report.code ?? ""}`;
27151
+ const now = Date.now();
27152
+ const last = lastSentAt.get(key);
27153
+ if (last && now - last < ALARM_THROTTLE_MS) return;
27154
+ lastSentAt.set(key, now);
27155
+ postFeishuWebhook(RPA_ERROR_WEBHOOK_URL, buildFeishuPostMessage(report)).catch(()=>{});
27156
+ } catch {}
27157
+ };
27044
27158
  var dist = __webpack_require__("../../node_modules/.pnpm/socks-proxy-agent@8.0.4/node_modules/socks-proxy-agent/dist/index.js");
27045
27159
  const PROXY_CREDENTIALS = [
27046
27160
  {
@@ -27143,9 +27257,20 @@ var __webpack_exports__ = {};
27143
27257
  url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
27144
27258
  data: params
27145
27259
  }).catch((err)=>{
27260
+ reportFeishuAlarm({
27261
+ level: "alarm",
27262
+ platform: "ip-pool",
27263
+ source: "proxy",
27264
+ stage: "POST /ip-pool/pool/eip/proxy",
27265
+ errorType: "PROXY_REQUEST_FAILED",
27266
+ code: err?.code,
27267
+ msg: `请求代理失败:${err.message},区域:${addr ?? "-"},AccountId:${accountId ?? "-"}`,
27268
+ url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
27269
+ title: "代理异常"
27270
+ });
27146
27271
  throw {
27147
27272
  code: 414,
27148
- message: `请求代理失败:${err.message}`,
27273
+ message: USER_MESSAGE.PROXY_UNAVAILABLE,
27149
27274
  data: {}
27150
27275
  };
27151
27276
  });
@@ -27165,12 +27290,53 @@ var __webpack_exports__ = {};
27165
27290
  } : null;
27166
27291
  return proxyAgent;
27167
27292
  }
27293
+ const ALARM_STATUS = new Set([
27294
+ 401,
27295
+ 403,
27296
+ 429,
27297
+ 461,
27298
+ 471
27299
+ ]);
27300
+ const HTTP_STATUS_MESSAGE = {
27301
+ 400: "请求参数错误,请检查参数格式是否正确!",
27302
+ 401: "登录状态已失效,请重新登录后重试!",
27303
+ 403: "没有访问权限,账号可能受限或签名已失效!",
27304
+ 404: "请求的资源不存在,请检查接口地址!",
27305
+ 405: "请求方法不被允许,请检查接口调用方式!",
27306
+ 406: "服务端无法返回可接受的内容格式!",
27307
+ 407: "代理需要身份验证,请检查代理配置!",
27308
+ 408: "请求超时,请检查网络连接!",
27309
+ 409: "请求冲突,资源状态已变更,请刷新后重试!",
27310
+ 410: "请求的资源已被移除!",
27311
+ 412: "请求前置条件不满足,请刷新后重试!",
27312
+ 413: "提交内容过大,请压缩或分批后重试!",
27313
+ 414: "请求地址过长,请检查参数!",
27314
+ 415: "不支持的内容类型,请检查请求格式!",
27315
+ 422: "请求内容校验失败,请检查参数内容!",
27316
+ 423: "资源已被锁定,请稍后重试!",
27317
+ 429: "请求过于频繁,请稍后重试!",
27318
+ 431: "请求头过大,请清理 Cookie 后重试!",
27319
+ 451: "内容不合规或因法律原因被拒绝!",
27320
+ 461: "账号可能受限,请在网页上完成验证后重试!",
27321
+ 471: "账号可能受限,请在网页上完成验证后重试!",
27322
+ 500: "服务器内部错误,请稍后重试!",
27323
+ 501: "服务端不支持该请求,请稍后重试!",
27324
+ 502: "网关错误,请稍后重试!",
27325
+ 503: "服务暂时不可用,请稍后重试!",
27326
+ 504: "网关超时,请稍后重试!",
27327
+ 507: "服务端存储空间不足,请稍后重试!",
27328
+ 509: "服务带宽超限,请稍后重试!",
27329
+ 520: "服务端返回未知错误,请稍后重试!",
27330
+ 521: "源站拒绝连接,请稍后重试!",
27331
+ 522: "源站连接超时,请稍后重试!",
27332
+ 524: "源站响应超时,请稍后重试!"
27333
+ };
27168
27334
  class Http {
27169
27335
  static handleApiError(error) {
27170
27336
  if (error && "object" == typeof error && "code" in error && "message" in error) return error;
27171
27337
  return {
27172
27338
  code: 500,
27173
- message: error instanceof Error ? error.message : "未知错误",
27339
+ message: USER_MESSAGE.SYSTEM_ERROR,
27174
27340
  data: error
27175
27341
  };
27176
27342
  }
@@ -27225,6 +27391,18 @@ var __webpack_exports__ = {};
27225
27391
  const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
27226
27392
  if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
27227
27393
  }
27394
+ if (error.response?.status === 461 || error.response?.status === 471) {
27395
+ const h = error.response?.headers ?? {};
27396
+ const pick = (name)=>h[name] ?? h[name.toLowerCase()];
27397
+ this.logger?.warn(`[${error.response.status} 风控验证] URL: ${error.config?.url} Verifytype: ${pick("Verifytype") ?? "-"} Verifyuuid: ${pick("Verifyuuid") ?? "-"} Verifybiz: ${pick("Verifybiz") ?? "-"}`);
27398
+ this.logger?.warn(`[${error.response.status} 响应头] ${JSON.stringify(h)}`);
27399
+ errorResponse.extra = {
27400
+ ...errorResponse.extra,
27401
+ verifyType: pick("Verifytype"),
27402
+ verifyUuid: pick("Verifyuuid"),
27403
+ verifyBiz: pick("Verifybiz")
27404
+ };
27405
+ }
27228
27406
  if (error.response?.data) {
27229
27407
  if ("object" == typeof error.response.data) {
27230
27408
  const serverError = error.response.data;
@@ -27255,11 +27433,17 @@ var __webpack_exports__ = {};
27255
27433
  _message = "DNS 查询超时,请稍后重试!";
27256
27434
  break;
27257
27435
  case "ERR_BAD_REQUEST":
27258
- _message = "请求出现错误,请检查请求参数!";
27259
- break;
27436
+ {
27437
+ const status = error.response?.status;
27438
+ _message = status && HTTP_STATUS_MESSAGE[status] || `请求失败,状态码${status ?? "unknown"}!`;
27439
+ break;
27440
+ }
27260
27441
  case "ERR_BAD_RESPONSE":
27261
- _message = `服务器响应异常 (${error.response?.status ?? "unknown"}),请稍后重试!`;
27262
- break;
27442
+ {
27443
+ const status = error.response?.status;
27444
+ _message = status && HTTP_STATUS_MESSAGE[status] || `服务器响应异常 (${status ?? "unknown"}),请稍后重试!`;
27445
+ break;
27446
+ }
27263
27447
  case "ERR_CANCELED":
27264
27448
  errorResponse.code = 414;
27265
27449
  _message = "请求连接超时,请稍候重试!";
@@ -27270,11 +27454,14 @@ var __webpack_exports__ = {};
27270
27454
  }
27271
27455
  break;
27272
27456
  default:
27273
- this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
27274
- errorString: stringifyError(error)
27275
- });
27276
- _message = `网络错误: ${error.message}`;
27277
- break;
27457
+ {
27458
+ this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
27459
+ errorString: stringifyError(error)
27460
+ });
27461
+ const status = error.response?.status;
27462
+ _message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
27463
+ break;
27464
+ }
27278
27465
  }
27279
27466
  }
27280
27467
  if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
@@ -27284,6 +27471,18 @@ var __webpack_exports__ = {};
27284
27471
  errorResponse.message = message;
27285
27472
  }
27286
27473
  if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
27474
+ const status = error.response?.status;
27475
+ reportFeishuAlarm({
27476
+ level: status && ALARM_STATUS.has(status) ? "alarm" : "warning",
27477
+ platform: this.platform || "unknown",
27478
+ source: "http",
27479
+ stage: `${(error.config?.method || "get").toUpperCase()} ${error.config?.url || "-"}`,
27480
+ errorType: status ? `HTTP_${status}` : error.code || "NETWORK_ERROR",
27481
+ code: errorResponse.code,
27482
+ msg: errorResponse.message,
27483
+ url: error.config?.url,
27484
+ title: "RPA接口异常"
27485
+ });
27287
27486
  throw errorResponse;
27288
27487
  });
27289
27488
  }
@@ -36543,7 +36742,7 @@ var __webpack_exports__ = {};
36543
36742
  });
36544
36743
  const qrData = qrCodeResponse?.data;
36545
36744
  task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
36546
- if (qrData?.error_code !== 0) return utils_response(414, `获取二维码失败: error_code=${qrData?.error_code}`, "");
36745
+ if (qrData?.error_code !== 0) return utils_response(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
36547
36746
  return utils_response(0, "获取二维码成功", {
36548
36747
  qrcode: qrData.qrcode,
36549
36748
  token: qrData.token,
@@ -36558,7 +36757,7 @@ var __webpack_exports__ = {};
36558
36757
  } catch (err) {
36559
36758
  const msg = err instanceof Error ? err.message : String(err);
36560
36759
  task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
36561
- return utils_response(500, `获取二维码失败: ${msg}`, "");
36760
+ return utils_response(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
36562
36761
  }
36563
36762
  };
36564
36763
  const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
@@ -38812,18 +39011,10 @@ var __webpack_exports__ = {};
38812
39011
  });
38813
39012
  } catch (error) {
38814
39013
  const handledError = Http.handleApiError(error);
38815
- const isProxyOrNetworkError = [
38816
- 599,
38817
- 500,
38818
- 502,
38819
- 503,
38820
- 504
38821
- ].includes(handledError.code);
38822
- if (isProxyOrNetworkError) {
38823
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
38824
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
38825
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
38826
- task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
39014
+ const classified = classifyPublishError(handledError);
39015
+ if (classified) {
39016
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
39017
+ task.logger.error(`[douyinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
38827
39018
  await updateTaskState?.({
38828
39019
  state: types_TaskState.FAILED,
38829
39020
  error: message
@@ -40541,7 +40732,7 @@ var __webpack_exports__ = {};
40541
40732
  }
40542
40733
  const errMsg = error instanceof Error ? error.message : String(error);
40543
40734
  _task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
40544
- return types_errorResponse(errMsg || "抖音账号数据获取失败");
40735
+ return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
40545
40736
  }
40546
40737
  }
40547
40738
  async function getShipinhaoData(_task, params) {
@@ -40672,7 +40863,7 @@ var __webpack_exports__ = {};
40672
40863
  }
40673
40864
  const errMsg = error instanceof Error ? error.message : String(error);
40674
40865
  _task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
40675
- return types_errorResponse(errMsg || "视频号账号数据获取失败");
40866
+ return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
40676
40867
  }
40677
40868
  }
40678
40869
  async function getToutiaoData(_task, params) {
@@ -41113,7 +41304,9 @@ var __webpack_exports__ = {};
41113
41304
  } : null
41114
41305
  }, "百家号文章数据获取成功");
41115
41306
  } catch (error) {
41116
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "百家号文章数据获取失败");
41307
+ const errMsg = error instanceof Error ? error.message : String(error);
41308
+ _task.logger.error(`百家号文章数据获取失败: ${errMsg}`);
41309
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.BJH_POST_FETCH_FAILED);
41117
41310
  }
41118
41311
  }
41119
41312
  async function handleDouyinData(_task, params) {
@@ -41208,7 +41401,9 @@ var __webpack_exports__ = {};
41208
41401
  } : null
41209
41402
  }, "抖音数据获取成功");
41210
41403
  } catch (error) {
41211
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "抖音数据获取失败");
41404
+ const errMsg = error instanceof Error ? error.message : String(error);
41405
+ _task.logger.error(`抖音作品数据获取失败: ${errMsg}`);
41406
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.DOUYIN_POST_FETCH_FAILED);
41212
41407
  }
41213
41408
  }
41214
41409
  async function handleShipinhaoData(_task, params) {
@@ -41373,8 +41568,9 @@ var __webpack_exports__ = {};
41373
41568
  }, "视频号数据获取成功");
41374
41569
  } catch (error) {
41375
41570
  const errMsg = error instanceof Error ? error.message : String(error);
41571
+ _task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
41376
41572
  if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
41377
- return searchPublishInfo_types_errorResponse(errMsg || "视频号数据获取失败");
41573
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
41378
41574
  }
41379
41575
  }
41380
41576
  async function handleToutiaoData(_task, params) {
@@ -41459,7 +41655,9 @@ var __webpack_exports__ = {};
41459
41655
  } : null
41460
41656
  }, "头条号文章文章获取成功");
41461
41657
  } catch (error) {
41462
- return searchPublishInfo_types_errorResponse(error instanceof Error ? error.message : "头条号文章数据获取失败");
41658
+ const errMsg = error instanceof Error ? error.message : String(error);
41659
+ _task.logger.error(`头条号文章数据获取失败: ${errMsg}`);
41660
+ return searchPublishInfo_types_errorResponse(USER_MESSAGE.TT_POST_FETCH_FAILED);
41463
41661
  }
41464
41662
  }
41465
41663
  const external_node_vm_namespaceObject = require("node:vm");
@@ -43836,18 +44034,10 @@ var __webpack_exports__ = {};
43836
44034
  });
43837
44035
  } catch (error) {
43838
44036
  const handledError = Http.handleApiError(error);
43839
- const isProxyOrNetworkError = [
43840
- 599,
43841
- 500,
43842
- 502,
43843
- 503,
43844
- 504
43845
- ].includes(handledError.code);
43846
- if (isProxyOrNetworkError) {
43847
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
43848
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
43849
- const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
43850
- task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
44037
+ const classified = classifyPublishError(handledError);
44038
+ if (classified) {
44039
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
44040
+ task.logger.error(`[shipinhaoPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
43851
44041
  await updateTaskState?.({
43852
44042
  state: types_TaskState.FAILED,
43853
44043
  error: message
@@ -44679,7 +44869,8 @@ var __webpack_exports__ = {};
44679
44869
  imageBuffer = Buffer.from(await external_node_fs_default().promises.readFile(filePath));
44680
44870
  }
44681
44871
  } catch (err) {
44682
- return utils_response(414, `读取图片失败: ${err instanceof Error ? err.message : String(err)}`, void 0);
44872
+ _task.logger.error(`读取图片失败: ${err instanceof Error ? err.message : String(err)}`);
44873
+ return utils_response(414, USER_MESSAGE.IMAGE_UPLOAD_FAILED, void 0);
44683
44874
  }
44684
44875
  const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
44685
44876
  const timestamp = Date.now().toString();
@@ -47190,18 +47381,10 @@ var __webpack_exports__ = {};
47190
47381
  });
47191
47382
  } catch (error) {
47192
47383
  const handledError = Http.handleApiError(error);
47193
- const isProxyOrNetworkError = [
47194
- 599,
47195
- 500,
47196
- 502,
47197
- 503,
47198
- 504
47199
- ].includes(handledError.code);
47200
- if (isProxyOrNetworkError) {
47201
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
47202
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
47203
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
47204
- task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
47384
+ const classified = classifyPublishError(handledError);
47385
+ if (classified) {
47386
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
47387
+ task.logger.error(`[weixinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
47205
47388
  await updateTaskState?.({
47206
47389
  state: types_TaskState.FAILED,
47207
47390
  error: message
@@ -48669,6 +48852,7 @@ var __webpack_exports__ = {};
48669
48852
  });
48670
48853
  return success(data, message);
48671
48854
  }
48855
+ task.logger.info(`[xiaohongshuPublish] publishData: ${JSON.stringify(publishData)} `);
48672
48856
  let publishResult;
48673
48857
  try {
48674
48858
  publishResult = await proxyHttp.api({
@@ -48679,23 +48863,15 @@ var __webpack_exports__ = {};
48679
48863
  defaultErrorMsg: "文章发布异常,请稍后重试。"
48680
48864
  }, {
48681
48865
  retries: 2,
48682
- retryDelay: 500,
48683
- timeout: 12000
48866
+ retryDelay: 3000,
48867
+ timeout: 30000
48684
48868
  });
48685
48869
  } catch (error) {
48686
48870
  const handledError = Http.handleApiError(error);
48687
- const isProxyOrNetworkError = [
48688
- 599,
48689
- 500,
48690
- 502,
48691
- 503,
48692
- 504
48693
- ].includes(handledError.code);
48694
- if (isProxyOrNetworkError) {
48695
- const isProxyRequest = handledError.extra?.isProxyRequest === true;
48696
- const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
48697
- const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
48698
- task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
48871
+ const classified = classifyPublishError(handledError);
48872
+ if (classified) {
48873
+ const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
48874
+ task.logger.error(`[xiaohongshuPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
48699
48875
  await updateTaskState?.({
48700
48876
  state: types_TaskState.FAILED,
48701
48877
  error: message
@@ -50673,5 +50849,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
50673
50849
  value: true
50674
50850
  });
50675
50851
 
50676
- //# sourceMappingURL=bundle.js.map
50677
- //# debugId=5ecc4d57-e612-5298-a097-3acb08559a65
50852
+ //# sourceMappingURL=bundle.js.map