From fc87029d7a85c93f46692985b2c9ea1d29198700 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 27 May 2025 16:29:40 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E7=9A=84=20=E9=94=99=E8=AF=AF=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/channel/bubbleMsgUtils.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/channel/bubbleMsgUtils.js b/src/channel/bubbleMsgUtils.js index 13d4156..8f88159 100644 --- a/src/channel/bubbleMsgUtils.js +++ b/src/channel/bubbleMsgUtils.js @@ -860,14 +860,14 @@ export const parseRenderMessageList = (messages) => { msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...template } : {}; // const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {}; let waCode, waError = ''; - if ((msgContent?.status || 'accepted') === 'failed' && msgContent.errorMessage && msg.msg_direction === 'outbound') { - (waCode = msgContent.errorMessage.match(/\(#(\d+)\)/)); - (waError = (whatsappError?.[waCode?.[1]] || whatsappError?.[msgContent.errorCode] || msgContent.errorMessage)); + if ((msgContent?.status || 'accepted') === 'failed' && (msgContent.errorMessage || msg.errors_code) && msg.msg_direction === 'outbound') { + (waCode = (msgContent.errorMessage || msg.errors_code).match(/\(#(\d+)\)/)); + (waError = (whatsappError?.[waCode?.[1]] || whatsappError?.[msgContent.errorCode] || msgContent.errorMessage || whatsappError?.[msg.errors_code])); if (!isEmpty(msgContent.whatsappApiError)) { waError = whatsappError?.[msgContent.whatsappApiError.code] || msgContent.whatsappApiError.message; // waError += `\n[${msgContent.errorCode}] ${whatsappError?.[msgContent.errorCode] || msgContent.errorMessage}`; } - if (msgContent.errorMessage.includes('Invalid E.146 phone number')) { + if ((msgContent.errorMessage || msg.errors_code).includes('Invalid E.146 phone number')) { waError = whatsappError.INVALID_PHONE_NUMBER; } } @@ -947,7 +947,7 @@ export const whatsappError = { '100': '参数错误, 请联系技术组', 'FORBIDDEN': '[FORBIDDEN] ', '4': '[4] 无法连接WhatsApp.\n请稍后重试', // (#4) Application request limit reached - '131026': '[131026] 消息无法投递(未同意WhatsApp 的隐私政策).\n请使用邮件联系', + '131026': '[131026] 消息无法投递(未同意WhatsApp 的隐私政策).\n请使用 邮件/个人WhatsApp 联系', '131047': '[131047] 会话未激活. \n请使用模板消息💬发送', '131053': '[131053] 文件上传失败.', '131048': '[131048] 账户被风控.', // 消息发送太多, 达到垃圾数量限制