perf: 发送失败: BAD_REQUEST 不显示系统消息

dev/timezone
Lei OT 1 year ago
parent f65b05c878
commit 449ca6f2a2

@ -233,7 +233,7 @@ const whatsappMsgMapped = {
return isEmpty(result?.whatsappMessage) ? null : { ...result.whatsappMessage, conversationid: result.conversationid, messageorigin: result.messageorigin }; return isEmpty(result?.whatsappMessage) ? null : { ...result.whatsappMessage, conversationid: result.conversationid, messageorigin: result.messageorigin };
}, },
contentToRender: (contentObj) => { contentToRender: (contentObj) => {
if ((contentObj?.status === 'failed' )) { if ((contentObj?.status === 'failed' ) && contentObj.errorCode !== 'BAD_REQUEST') {
contentObj = { contentObj = {
...contentObj, ...contentObj,
type: 'error', type: 'error',
@ -291,7 +291,8 @@ export const receivedMsgTypeMapped = {
getMsg: (result) => result, getMsg: (result) => result,
contentToRender: () => null, contentToRender: () => null,
contentToUpdate: (msgcontent) => { contentToUpdate: (msgcontent) => {
let apiErrorCode, apiErrorMsg = ''; let apiErrorCode,
apiErrorMsg = '';
const waCode = msgcontent.error.message.match(/\(#(\d+)\)/); const waCode = msgcontent.error.message.match(/\(#(\d+)\)/);
let waError = whatsappError?.[waCode?.[1]] || msgcontent.error.message; let waError = whatsappError?.[waCode?.[1]] || msgcontent.error.message;
@ -302,12 +303,13 @@ export const receivedMsgTypeMapped = {
apiErrorMsg = ''; apiErrorMsg = '';
} }
return { return {
...msgcontent, ...msgcontent,
id: msgcontent.actionId, id: msgcontent.actionId,
status: msgcontent?.status || 'failed', status: msgcontent?.status || 'failed',
dateString: `发送失败 ${waError} \n[${msgcontent.error.code}] ${apiErrorMsg}`, dateString: `发送失败 ${waError} \n[${msgcontent.error.code}] ${apiErrorMsg}`,
conversationid: msgcontent.actionId.split('.')[0], conversationid: msgcontent.actionId.split('.')[0],
};}, };
},
}, },
}; };
export const whatsappMsgTypeMapped = { export const whatsappMsgTypeMapped = {

Loading…
Cancel
Save