@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.
- package/dist/actions/searchPublishInfo/index.d.ts +1 -1
- package/dist/bundle.js +254 -79
- package/dist/bundle.js.map +1 -1
- package/dist/index.js +254 -79
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +253 -78
- package/dist/index.mjs.map +1 -1
- package/dist/utils/errorMessages.d.ts +41 -0
- package/dist/utils/feishuAlarm.d.ts +27 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
!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]="3cd6ec6b-b28f-5463-acdf-e643a9e5ec4c")}catch(e){}}();
|
|
3
1
|
var __webpack_modules__ = {
|
|
4
2
|
"./src/utils/XhsXsCommonEnc.js": function(module) {
|
|
5
3
|
var encrypt_lookup = [
|
|
@@ -4402,9 +4400,7 @@ var __webpack_exports__ = {};
|
|
|
4402
4400
|
});
|
|
4403
4401
|
const package_json_namespaceObject = require("@iflyrpa/share/package.json");
|
|
4404
4402
|
var package_json_default = /*#__PURE__*/ __webpack_require__.n(package_json_namespaceObject);
|
|
4405
|
-
var package_namespaceObject = {
|
|
4406
|
-
i8: "4.0.8"
|
|
4407
|
-
};
|
|
4403
|
+
var package_namespaceObject = JSON.parse('{"i8":"4.0.9-beta.1"}');
|
|
4408
4404
|
const share_namespaceObject = require("@iflyrpa/share");
|
|
4409
4405
|
const external_node_fs_namespaceObject = require("node:fs");
|
|
4410
4406
|
var external_node_fs_default = /*#__PURE__*/ __webpack_require__.n(external_node_fs_namespaceObject);
|
|
@@ -4420,6 +4416,124 @@ var __webpack_exports__ = {};
|
|
|
4420
4416
|
var external_node_crypto_default = /*#__PURE__*/ __webpack_require__.n(external_node_crypto_namespaceObject);
|
|
4421
4417
|
const external_axios_namespaceObject = require("axios");
|
|
4422
4418
|
var external_axios_default = /*#__PURE__*/ __webpack_require__.n(external_axios_namespaceObject);
|
|
4419
|
+
const USER_MESSAGE = {
|
|
4420
|
+
PROXY_UNAVAILABLE: "代理暂时不可用,请稍后重试或使用本地IP",
|
|
4421
|
+
NETWORK_ERROR: "网络异常,请稍后重试",
|
|
4422
|
+
SYSTEM_ERROR: "系统异常,请稍后重试或联系客服",
|
|
4423
|
+
PUBLISH_NETWORK: "发布失败,网络不稳定,请稍后重试",
|
|
4424
|
+
DOUYIN_ACCOUNT_FETCH_FAILED: "抖音数据获取失败,请稍后重试",
|
|
4425
|
+
SHIPINHAO_ACCOUNT_FETCH_FAILED: "视频号数据获取失败,请稍后重试",
|
|
4426
|
+
DOUYIN_POST_FETCH_FAILED: "抖音作品数据获取失败,请稍后重试",
|
|
4427
|
+
SHIPINHAO_POST_FETCH_FAILED: "视频号作品数据获取失败,请稍后重试",
|
|
4428
|
+
BJH_POST_FETCH_FAILED: "百家号作品数据获取失败,请稍后重试",
|
|
4429
|
+
TT_POST_FETCH_FAILED: "头条号作品数据获取失败,请稍后重试",
|
|
4430
|
+
QRCODE_FETCH_FAILED: "认证二维码获取失败,请稍后重试",
|
|
4431
|
+
IMAGE_UPLOAD_FAILED: "图片上传失败,请稍后重试或联系客服"
|
|
4432
|
+
};
|
|
4433
|
+
const NETWORK_CODES = [
|
|
4434
|
+
500,
|
|
4435
|
+
502,
|
|
4436
|
+
503,
|
|
4437
|
+
504
|
|
4438
|
+
];
|
|
4439
|
+
function classifyPublishError(handledError) {
|
|
4440
|
+
const { code } = handledError;
|
|
4441
|
+
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
4442
|
+
if (!NETWORK_CODES.includes(code) && 599 !== code) return null;
|
|
4443
|
+
const category = 599 === code || isProxyRequest ? "代理错误" : "网络错误";
|
|
4444
|
+
return {
|
|
4445
|
+
category,
|
|
4446
|
+
userMessage: USER_MESSAGE.PUBLISH_NETWORK
|
|
4447
|
+
};
|
|
4448
|
+
}
|
|
4449
|
+
const RPA_ERROR_WEBHOOK_URL = "https://open.xfchat.iflytek.com/open-apis/bot/v2/hook/d202c0dc-5af5-40bc-83ed-abc677caa4a5";
|
|
4450
|
+
const ALARM_THROTTLE_MS = 60000;
|
|
4451
|
+
const lastSentAt = new Map();
|
|
4452
|
+
const postFeishuWebhook = (webhookUrl, payload)=>external_axios_default().post(webhookUrl, payload, {
|
|
4453
|
+
headers: {
|
|
4454
|
+
"Content-Type": "application/json"
|
|
4455
|
+
},
|
|
4456
|
+
timeout: 10000
|
|
4457
|
+
});
|
|
4458
|
+
const buildFeishuPostMessage = (report)=>{
|
|
4459
|
+
const content = [
|
|
4460
|
+
[
|
|
4461
|
+
{
|
|
4462
|
+
tag: "text",
|
|
4463
|
+
text: `平台:${report.platform || "未知平台"}`
|
|
4464
|
+
}
|
|
4465
|
+
],
|
|
4466
|
+
[
|
|
4467
|
+
{
|
|
4468
|
+
tag: "text",
|
|
4469
|
+
text: `错误信息:${report.msg || "未知错误信息"}`
|
|
4470
|
+
}
|
|
4471
|
+
],
|
|
4472
|
+
[
|
|
4473
|
+
{
|
|
4474
|
+
tag: "text",
|
|
4475
|
+
text: `错误类型:${report.errorType || "未知错误类型"}`
|
|
4476
|
+
}
|
|
4477
|
+
],
|
|
4478
|
+
[
|
|
4479
|
+
{
|
|
4480
|
+
tag: "text",
|
|
4481
|
+
text: `阶段:${report.stage || "未知阶段"}`
|
|
4482
|
+
}
|
|
4483
|
+
],
|
|
4484
|
+
[
|
|
4485
|
+
{
|
|
4486
|
+
tag: "text",
|
|
4487
|
+
text: `等级:${report.level}`
|
|
4488
|
+
}
|
|
4489
|
+
],
|
|
4490
|
+
[
|
|
4491
|
+
{
|
|
4492
|
+
tag: "text",
|
|
4493
|
+
text: `来源:${report.source}`
|
|
4494
|
+
}
|
|
4495
|
+
]
|
|
4496
|
+
];
|
|
4497
|
+
if (void 0 !== report.code && null !== report.code) content.push([
|
|
4498
|
+
{
|
|
4499
|
+
tag: "text",
|
|
4500
|
+
text: `接口错误码:${report.code}`
|
|
4501
|
+
}
|
|
4502
|
+
]);
|
|
4503
|
+
if (report.url) content.push([
|
|
4504
|
+
{
|
|
4505
|
+
tag: "text",
|
|
4506
|
+
text: `地址:${report.url}`
|
|
4507
|
+
}
|
|
4508
|
+
]);
|
|
4509
|
+
if ("alarm" === report.level) content.push([
|
|
4510
|
+
{
|
|
4511
|
+
tag: "at",
|
|
4512
|
+
user_id: "all"
|
|
4513
|
+
}
|
|
4514
|
+
]);
|
|
4515
|
+
return {
|
|
4516
|
+
msg_type: "post",
|
|
4517
|
+
content: {
|
|
4518
|
+
post: {
|
|
4519
|
+
zh_cn: {
|
|
4520
|
+
title: report.title || "RPA异常",
|
|
4521
|
+
content
|
|
4522
|
+
}
|
|
4523
|
+
}
|
|
4524
|
+
}
|
|
4525
|
+
};
|
|
4526
|
+
};
|
|
4527
|
+
const reportFeishuAlarm = (report)=>{
|
|
4528
|
+
try {
|
|
4529
|
+
const key = `${report.platform}|${report.source}|${report.errorType}|${report.code ?? ""}`;
|
|
4530
|
+
const now = Date.now();
|
|
4531
|
+
const last = lastSentAt.get(key);
|
|
4532
|
+
if (last && now - last < ALARM_THROTTLE_MS) return;
|
|
4533
|
+
lastSentAt.set(key, now);
|
|
4534
|
+
postFeishuWebhook(RPA_ERROR_WEBHOOK_URL, buildFeishuPostMessage(report)).catch(()=>{});
|
|
4535
|
+
} catch {}
|
|
4536
|
+
};
|
|
4423
4537
|
const external_socks_proxy_agent_namespaceObject = require("socks-proxy-agent");
|
|
4424
4538
|
const PROXY_CREDENTIALS = [
|
|
4425
4539
|
{
|
|
@@ -4522,9 +4636,20 @@ var __webpack_exports__ = {};
|
|
|
4522
4636
|
url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
|
|
4523
4637
|
data: params
|
|
4524
4638
|
}).catch((err)=>{
|
|
4639
|
+
reportFeishuAlarm({
|
|
4640
|
+
level: "alarm",
|
|
4641
|
+
platform: "ip-pool",
|
|
4642
|
+
source: "proxy",
|
|
4643
|
+
stage: "POST /ip-pool/pool/eip/proxy",
|
|
4644
|
+
errorType: "PROXY_REQUEST_FAILED",
|
|
4645
|
+
code: err?.code,
|
|
4646
|
+
msg: `请求代理失败:${err.message},区域:${addr ?? "-"},AccountId:${accountId ?? "-"}`,
|
|
4647
|
+
url: "https://fetdev.iflysec.com/ip-pool/pool/eip/proxy",
|
|
4648
|
+
title: "代理异常"
|
|
4649
|
+
});
|
|
4525
4650
|
throw {
|
|
4526
4651
|
code: 414,
|
|
4527
|
-
message:
|
|
4652
|
+
message: USER_MESSAGE.PROXY_UNAVAILABLE,
|
|
4528
4653
|
data: {}
|
|
4529
4654
|
};
|
|
4530
4655
|
});
|
|
@@ -4544,12 +4669,53 @@ var __webpack_exports__ = {};
|
|
|
4544
4669
|
} : null;
|
|
4545
4670
|
return proxyAgent;
|
|
4546
4671
|
}
|
|
4672
|
+
const ALARM_STATUS = new Set([
|
|
4673
|
+
401,
|
|
4674
|
+
403,
|
|
4675
|
+
429,
|
|
4676
|
+
461,
|
|
4677
|
+
471
|
|
4678
|
+
]);
|
|
4679
|
+
const HTTP_STATUS_MESSAGE = {
|
|
4680
|
+
400: "请求参数错误,请检查参数格式是否正确!",
|
|
4681
|
+
401: "登录状态已失效,请重新登录后重试!",
|
|
4682
|
+
403: "没有访问权限,账号可能受限或签名已失效!",
|
|
4683
|
+
404: "请求的资源不存在,请检查接口地址!",
|
|
4684
|
+
405: "请求方法不被允许,请检查接口调用方式!",
|
|
4685
|
+
406: "服务端无法返回可接受的内容格式!",
|
|
4686
|
+
407: "代理需要身份验证,请检查代理配置!",
|
|
4687
|
+
408: "请求超时,请检查网络连接!",
|
|
4688
|
+
409: "请求冲突,资源状态已变更,请刷新后重试!",
|
|
4689
|
+
410: "请求的资源已被移除!",
|
|
4690
|
+
412: "请求前置条件不满足,请刷新后重试!",
|
|
4691
|
+
413: "提交内容过大,请压缩或分批后重试!",
|
|
4692
|
+
414: "请求地址过长,请检查参数!",
|
|
4693
|
+
415: "不支持的内容类型,请检查请求格式!",
|
|
4694
|
+
422: "请求内容校验失败,请检查参数内容!",
|
|
4695
|
+
423: "资源已被锁定,请稍后重试!",
|
|
4696
|
+
429: "请求过于频繁,请稍后重试!",
|
|
4697
|
+
431: "请求头过大,请清理 Cookie 后重试!",
|
|
4698
|
+
451: "内容不合规或因法律原因被拒绝!",
|
|
4699
|
+
461: "账号可能受限,请在网页上完成验证后重试!",
|
|
4700
|
+
471: "账号可能受限,请在网页上完成验证后重试!",
|
|
4701
|
+
500: "服务器内部错误,请稍后重试!",
|
|
4702
|
+
501: "服务端不支持该请求,请稍后重试!",
|
|
4703
|
+
502: "网关错误,请稍后重试!",
|
|
4704
|
+
503: "服务暂时不可用,请稍后重试!",
|
|
4705
|
+
504: "网关超时,请稍后重试!",
|
|
4706
|
+
507: "服务端存储空间不足,请稍后重试!",
|
|
4707
|
+
509: "服务带宽超限,请稍后重试!",
|
|
4708
|
+
520: "服务端返回未知错误,请稍后重试!",
|
|
4709
|
+
521: "源站拒绝连接,请稍后重试!",
|
|
4710
|
+
522: "源站连接超时,请稍后重试!",
|
|
4711
|
+
524: "源站响应超时,请稍后重试!"
|
|
4712
|
+
};
|
|
4547
4713
|
class Http {
|
|
4548
4714
|
static handleApiError(error) {
|
|
4549
4715
|
if (error && "object" == typeof error && "code" in error && "message" in error) return error;
|
|
4550
4716
|
return {
|
|
4551
4717
|
code: 500,
|
|
4552
|
-
message:
|
|
4718
|
+
message: USER_MESSAGE.SYSTEM_ERROR,
|
|
4553
4719
|
data: error
|
|
4554
4720
|
};
|
|
4555
4721
|
}
|
|
@@ -4604,6 +4770,18 @@ var __webpack_exports__ = {};
|
|
|
4604
4770
|
const verifyDecision = error.response?.headers?.["x-tt-verify-passport-decision"];
|
|
4605
4771
|
if (verifyDecision) this.logger?.warn(`[403 验证决策] x-tt-verify-passport-decision: ${verifyDecision}`);
|
|
4606
4772
|
}
|
|
4773
|
+
if (error.response?.status === 461 || error.response?.status === 471) {
|
|
4774
|
+
const h = error.response?.headers ?? {};
|
|
4775
|
+
const pick = (name)=>h[name] ?? h[name.toLowerCase()];
|
|
4776
|
+
this.logger?.warn(`[${error.response.status} 风控验证] URL: ${error.config?.url} Verifytype: ${pick("Verifytype") ?? "-"} Verifyuuid: ${pick("Verifyuuid") ?? "-"} Verifybiz: ${pick("Verifybiz") ?? "-"}`);
|
|
4777
|
+
this.logger?.warn(`[${error.response.status} 响应头] ${JSON.stringify(h)}`);
|
|
4778
|
+
errorResponse.extra = {
|
|
4779
|
+
...errorResponse.extra,
|
|
4780
|
+
verifyType: pick("Verifytype"),
|
|
4781
|
+
verifyUuid: pick("Verifyuuid"),
|
|
4782
|
+
verifyBiz: pick("Verifybiz")
|
|
4783
|
+
};
|
|
4784
|
+
}
|
|
4607
4785
|
if (error.response?.data) {
|
|
4608
4786
|
if ("object" == typeof error.response.data) {
|
|
4609
4787
|
const serverError = error.response.data;
|
|
@@ -4634,11 +4812,17 @@ var __webpack_exports__ = {};
|
|
|
4634
4812
|
_message = "DNS 查询超时,请稍后重试!";
|
|
4635
4813
|
break;
|
|
4636
4814
|
case "ERR_BAD_REQUEST":
|
|
4637
|
-
|
|
4638
|
-
|
|
4815
|
+
{
|
|
4816
|
+
const status = error.response?.status;
|
|
4817
|
+
_message = status && HTTP_STATUS_MESSAGE[status] || `请求失败,状态码${status ?? "unknown"}!`;
|
|
4818
|
+
break;
|
|
4819
|
+
}
|
|
4639
4820
|
case "ERR_BAD_RESPONSE":
|
|
4640
|
-
|
|
4641
|
-
|
|
4821
|
+
{
|
|
4822
|
+
const status = error.response?.status;
|
|
4823
|
+
_message = status && HTTP_STATUS_MESSAGE[status] || `服务器响应异常 (${status ?? "unknown"}),请稍后重试!`;
|
|
4824
|
+
break;
|
|
4825
|
+
}
|
|
4642
4826
|
case "ERR_CANCELED":
|
|
4643
4827
|
errorResponse.code = 414;
|
|
4644
4828
|
_message = "请求连接超时,请稍候重试!";
|
|
@@ -4649,11 +4833,14 @@ var __webpack_exports__ = {};
|
|
|
4649
4833
|
}
|
|
4650
4834
|
break;
|
|
4651
4835
|
default:
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4836
|
+
{
|
|
4837
|
+
this.logger?.debug(`未处理的网络错误代码: ${error.code} ${error.message}`, {
|
|
4838
|
+
errorString: stringifyError(error)
|
|
4839
|
+
});
|
|
4840
|
+
const status = error.response?.status;
|
|
4841
|
+
_message = status && HTTP_STATUS_MESSAGE[status] || USER_MESSAGE.NETWORK_ERROR;
|
|
4842
|
+
break;
|
|
4843
|
+
}
|
|
4657
4844
|
}
|
|
4658
4845
|
}
|
|
4659
4846
|
if (error.code && !error.response?.data) errorResponse.message = _message || errorResponse.message;
|
|
@@ -4663,6 +4850,18 @@ var __webpack_exports__ = {};
|
|
|
4663
4850
|
errorResponse.message = message;
|
|
4664
4851
|
}
|
|
4665
4852
|
if (error.message.includes("Proxy connection ended")) errorResponse.message = "所在区域代理连接超时,请更换区域或稍后重试!";
|
|
4853
|
+
const status = error.response?.status;
|
|
4854
|
+
reportFeishuAlarm({
|
|
4855
|
+
level: status && ALARM_STATUS.has(status) ? "alarm" : "warning",
|
|
4856
|
+
platform: this.platform || "unknown",
|
|
4857
|
+
source: "http",
|
|
4858
|
+
stage: `${(error.config?.method || "get").toUpperCase()} ${error.config?.url || "-"}`,
|
|
4859
|
+
errorType: status ? `HTTP_${status}` : error.code || "NETWORK_ERROR",
|
|
4860
|
+
code: errorResponse.code,
|
|
4861
|
+
msg: errorResponse.message,
|
|
4862
|
+
url: error.config?.url,
|
|
4863
|
+
title: "RPA接口异常"
|
|
4864
|
+
});
|
|
4666
4865
|
throw errorResponse;
|
|
4667
4866
|
});
|
|
4668
4867
|
}
|
|
@@ -5432,7 +5631,7 @@ var __webpack_exports__ = {};
|
|
|
5432
5631
|
Number.MAX_VALUE
|
|
5433
5632
|
]
|
|
5434
5633
|
};
|
|
5435
|
-
function
|
|
5634
|
+
function util_pick(schema, mask) {
|
|
5436
5635
|
const currDef = schema._zod.def;
|
|
5437
5636
|
const def = mergeDefs(schema._zod.def, {
|
|
5438
5637
|
get shape () {
|
|
@@ -8413,7 +8612,7 @@ var __webpack_exports__ = {};
|
|
|
8413
8612
|
inst.extend = (incoming)=>extend(inst, incoming);
|
|
8414
8613
|
inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
|
|
8415
8614
|
inst.merge = (other)=>merge(inst, other);
|
|
8416
|
-
inst.pick = (mask)=>
|
|
8615
|
+
inst.pick = (mask)=>util_pick(inst, mask);
|
|
8417
8616
|
inst.omit = (mask)=>omit(inst, mask);
|
|
8418
8617
|
inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
|
|
8419
8618
|
inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
|
|
@@ -12407,7 +12606,7 @@ var __webpack_exports__ = {};
|
|
|
12407
12606
|
});
|
|
12408
12607
|
const qrData = qrCodeResponse?.data;
|
|
12409
12608
|
task.logger.info(`获取二维码响应: error_code=${qrData?.error_code}, message=${qrCodeResponse?.message}`);
|
|
12410
|
-
if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414,
|
|
12609
|
+
if (qrData?.error_code !== 0) return (0, share_namespaceObject.response)(414, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
|
|
12411
12610
|
return (0, share_namespaceObject.response)(0, "获取二维码成功", {
|
|
12412
12611
|
qrcode: qrData.qrcode,
|
|
12413
12612
|
token: qrData.token,
|
|
@@ -12422,7 +12621,7 @@ var __webpack_exports__ = {};
|
|
|
12422
12621
|
} catch (err) {
|
|
12423
12622
|
const msg = err instanceof Error ? err.message : String(err);
|
|
12424
12623
|
task.logger.warn(`[douyinGetVerifyQrCode] 获取二维码失败: ${msg}`);
|
|
12425
|
-
return (0, share_namespaceObject.response)(500,
|
|
12624
|
+
return (0, share_namespaceObject.response)(500, USER_MESSAGE.QRCODE_FETCH_FAILED, "");
|
|
12426
12625
|
}
|
|
12427
12626
|
};
|
|
12428
12627
|
const DouyinGetWorkListParamsSchema = ActionCommonParamsSchema.extend({
|
|
@@ -13741,18 +13940,10 @@ var __webpack_exports__ = {};
|
|
|
13741
13940
|
});
|
|
13742
13941
|
} catch (error) {
|
|
13743
13942
|
const handledError = Http.handleApiError(error);
|
|
13744
|
-
const
|
|
13745
|
-
|
|
13746
|
-
|
|
13747
|
-
|
|
13748
|
-
503,
|
|
13749
|
-
504
|
|
13750
|
-
].includes(handledError.code);
|
|
13751
|
-
if (isProxyOrNetworkError) {
|
|
13752
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
13753
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
13754
|
-
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13755
|
-
task.logger.error(`[douyinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
13943
|
+
const classified = classifyPublishError(handledError);
|
|
13944
|
+
if (classified) {
|
|
13945
|
+
const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
13946
|
+
task.logger.error(`[douyinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
|
|
13756
13947
|
await updateTaskState?.({
|
|
13757
13948
|
state: share_namespaceObject.TaskState.FAILED,
|
|
13758
13949
|
error: message
|
|
@@ -15470,7 +15661,7 @@ var __webpack_exports__ = {};
|
|
|
15470
15661
|
}
|
|
15471
15662
|
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15472
15663
|
_task.logger.error(`抖音账号数据获取失败: ${errMsg}`);
|
|
15473
|
-
return types_errorResponse(
|
|
15664
|
+
return types_errorResponse(USER_MESSAGE.DOUYIN_ACCOUNT_FETCH_FAILED);
|
|
15474
15665
|
}
|
|
15475
15666
|
}
|
|
15476
15667
|
async function getShipinhaoData(_task, params) {
|
|
@@ -15601,7 +15792,7 @@ var __webpack_exports__ = {};
|
|
|
15601
15792
|
}
|
|
15602
15793
|
const errMsg = error instanceof Error ? error.message : String(error);
|
|
15603
15794
|
_task.logger.error(`视频号账号数据获取失败: ${errMsg}`);
|
|
15604
|
-
return types_errorResponse(
|
|
15795
|
+
return types_errorResponse(USER_MESSAGE.SHIPINHAO_ACCOUNT_FETCH_FAILED);
|
|
15605
15796
|
}
|
|
15606
15797
|
}
|
|
15607
15798
|
async function getToutiaoData(_task, params) {
|
|
@@ -16042,7 +16233,9 @@ var __webpack_exports__ = {};
|
|
|
16042
16233
|
} : null
|
|
16043
16234
|
}, "百家号文章数据获取成功");
|
|
16044
16235
|
} catch (error) {
|
|
16045
|
-
|
|
16236
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16237
|
+
_task.logger.error(`百家号文章数据获取失败: ${errMsg}`);
|
|
16238
|
+
return searchPublishInfo_types_errorResponse(USER_MESSAGE.BJH_POST_FETCH_FAILED);
|
|
16046
16239
|
}
|
|
16047
16240
|
}
|
|
16048
16241
|
async function handleDouyinData(_task, params) {
|
|
@@ -16137,7 +16330,9 @@ var __webpack_exports__ = {};
|
|
|
16137
16330
|
} : null
|
|
16138
16331
|
}, "抖音数据获取成功");
|
|
16139
16332
|
} catch (error) {
|
|
16140
|
-
|
|
16333
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16334
|
+
_task.logger.error(`抖音作品数据获取失败: ${errMsg}`);
|
|
16335
|
+
return searchPublishInfo_types_errorResponse(USER_MESSAGE.DOUYIN_POST_FETCH_FAILED);
|
|
16141
16336
|
}
|
|
16142
16337
|
}
|
|
16143
16338
|
async function handleShipinhaoData(_task, params) {
|
|
@@ -16302,8 +16497,9 @@ var __webpack_exports__ = {};
|
|
|
16302
16497
|
}, "视频号数据获取成功");
|
|
16303
16498
|
} catch (error) {
|
|
16304
16499
|
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16500
|
+
_task.logger.error(`视频号作品数据获取失败: ${errMsg}`);
|
|
16305
16501
|
if (errMsg.startsWith("AUTH_ERROR:")) return searchPublishInfo_types_errorResponse("视频号数据获取失败,请检查账号状态", 414);
|
|
16306
|
-
return searchPublishInfo_types_errorResponse(
|
|
16502
|
+
return searchPublishInfo_types_errorResponse(USER_MESSAGE.SHIPINHAO_POST_FETCH_FAILED);
|
|
16307
16503
|
}
|
|
16308
16504
|
}
|
|
16309
16505
|
async function handleToutiaoData(_task, params) {
|
|
@@ -16388,7 +16584,9 @@ var __webpack_exports__ = {};
|
|
|
16388
16584
|
} : null
|
|
16389
16585
|
}, "头条号文章文章获取成功");
|
|
16390
16586
|
} catch (error) {
|
|
16391
|
-
|
|
16587
|
+
const errMsg = error instanceof Error ? error.message : String(error);
|
|
16588
|
+
_task.logger.error(`头条号文章数据获取失败: ${errMsg}`);
|
|
16589
|
+
return searchPublishInfo_types_errorResponse(USER_MESSAGE.TT_POST_FETCH_FAILED);
|
|
16392
16590
|
}
|
|
16393
16591
|
}
|
|
16394
16592
|
const external_node_vm_namespaceObject = require("node:vm");
|
|
@@ -18765,18 +18963,10 @@ var __webpack_exports__ = {};
|
|
|
18765
18963
|
});
|
|
18766
18964
|
} catch (error) {
|
|
18767
18965
|
const handledError = Http.handleApiError(error);
|
|
18768
|
-
const
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
503,
|
|
18773
|
-
504
|
|
18774
|
-
].includes(handledError.code);
|
|
18775
|
-
if (isProxyOrNetworkError) {
|
|
18776
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
18777
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
18778
|
-
const message = `图文发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
18779
|
-
task.logger.error(`[shipinhaoPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
18966
|
+
const classified = classifyPublishError(handledError);
|
|
18967
|
+
if (classified) {
|
|
18968
|
+
const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
18969
|
+
task.logger.error(`[shipinhaoPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
|
|
18780
18970
|
await updateTaskState?.({
|
|
18781
18971
|
state: share_namespaceObject.TaskState.FAILED,
|
|
18782
18972
|
error: message
|
|
@@ -19608,7 +19798,8 @@ var __webpack_exports__ = {};
|
|
|
19608
19798
|
imageBuffer = Buffer.from(await external_node_fs_default().promises.readFile(filePath));
|
|
19609
19799
|
}
|
|
19610
19800
|
} catch (err) {
|
|
19611
|
-
|
|
19801
|
+
_task.logger.error(`读取图片失败: ${err instanceof Error ? err.message : String(err)}`);
|
|
19802
|
+
return (0, share_namespaceObject.response)(414, USER_MESSAGE.IMAGE_UPLOAD_FAILED, void 0);
|
|
19612
19803
|
}
|
|
19613
19804
|
const md5 = (0, external_node_crypto_namespaceObject.createHash)("md5").update(imageBuffer).digest("hex");
|
|
19614
19805
|
const timestamp = Date.now().toString();
|
|
@@ -22119,18 +22310,10 @@ var __webpack_exports__ = {};
|
|
|
22119
22310
|
});
|
|
22120
22311
|
} catch (error) {
|
|
22121
22312
|
const handledError = Http.handleApiError(error);
|
|
22122
|
-
const
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
503,
|
|
22127
|
-
504
|
|
22128
|
-
].includes(handledError.code);
|
|
22129
|
-
if (isProxyOrNetworkError) {
|
|
22130
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
22131
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
22132
|
-
const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
22133
|
-
task.logger.error(`[weixinPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
22313
|
+
const classified = classifyPublishError(handledError);
|
|
22314
|
+
if (classified) {
|
|
22315
|
+
const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
22316
|
+
task.logger.error(`[weixinPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
|
|
22134
22317
|
await updateTaskState?.({
|
|
22135
22318
|
state: share_namespaceObject.TaskState.FAILED,
|
|
22136
22319
|
error: message
|
|
@@ -23598,6 +23781,7 @@ var __webpack_exports__ = {};
|
|
|
23598
23781
|
});
|
|
23599
23782
|
return (0, share_namespaceObject.success)(data, message);
|
|
23600
23783
|
}
|
|
23784
|
+
task.logger.info(`[xiaohongshuPublish] publishData: ${JSON.stringify(publishData)} `);
|
|
23601
23785
|
let publishResult;
|
|
23602
23786
|
try {
|
|
23603
23787
|
publishResult = await proxyHttp.api({
|
|
@@ -23608,23 +23792,15 @@ var __webpack_exports__ = {};
|
|
|
23608
23792
|
defaultErrorMsg: "文章发布异常,请稍后重试。"
|
|
23609
23793
|
}, {
|
|
23610
23794
|
retries: 2,
|
|
23611
|
-
retryDelay:
|
|
23612
|
-
timeout:
|
|
23795
|
+
retryDelay: 3000,
|
|
23796
|
+
timeout: 30000
|
|
23613
23797
|
});
|
|
23614
23798
|
} catch (error) {
|
|
23615
23799
|
const handledError = Http.handleApiError(error);
|
|
23616
|
-
const
|
|
23617
|
-
|
|
23618
|
-
|
|
23619
|
-
|
|
23620
|
-
503,
|
|
23621
|
-
504
|
|
23622
|
-
].includes(handledError.code);
|
|
23623
|
-
if (isProxyOrNetworkError) {
|
|
23624
|
-
const isProxyRequest = handledError.extra?.isProxyRequest === true;
|
|
23625
|
-
const errorType = 599 === handledError.code || isProxyRequest ? "代理错误" : "网络错误";
|
|
23626
|
-
const message = `文章发布失败,${errorType}:${handledError.message}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
23627
|
-
task.logger.error(`[xiaohongshuPublish] ${errorType},直接返回: ${message}`, stringifyError(handledError));
|
|
23800
|
+
const classified = classifyPublishError(handledError);
|
|
23801
|
+
if (classified) {
|
|
23802
|
+
const message = `${classified.userMessage}${task.debug ? ` ${http.proxyInfo}` : ""}`;
|
|
23803
|
+
task.logger.error(`[xiaohongshuPublish] ${classified.category},直接返回: ${handledError.message} (code=${handledError.code})`, stringifyError(handledError));
|
|
23628
23804
|
await updateTaskState?.({
|
|
23629
23805
|
state: share_namespaceObject.TaskState.FAILED,
|
|
23630
23806
|
error: message
|
|
@@ -25602,5 +25778,4 @@ if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_targe
|
|
|
25602
25778
|
value: true
|
|
25603
25779
|
});
|
|
25604
25780
|
|
|
25605
|
-
//# sourceMappingURL=index.js.map
|
|
25606
|
-
//# debugId=3cd6ec6b-b28f-5463-acdf-e643a9e5ec4c
|
|
25781
|
+
//# sourceMappingURL=index.js.map
|