From eb7075633bf5295a66fa443942d00ffaefe7e509 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Tue, 3 Dec 2024 15:30:30 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=87=E6=8D=A2=E4=B9=8B=E5=90=8E?= =?UTF-8?q?=E5=BC=95=E7=94=A8=E6=B6=88=E6=81=AF=E7=9A=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/channel/bubbleMsgUtils.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/channel/bubbleMsgUtils.js b/src/channel/bubbleMsgUtils.js index 2876fae..4d22f32 100644 --- a/src/channel/bubbleMsgUtils.js +++ b/src/channel/bubbleMsgUtils.js @@ -444,7 +444,7 @@ export const whatsappMsgTypeMapped = { }, text: { type: 'text', - data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || msg?.from || '' }), + data: (msg) => ({ id: msg.wamid, text: autoLinkText(msg?.text?.body), originText: msg?.text?.body, title: msg?.customerProfile?.name || msg?.from || '', idx: '--------------------------------------' }), renderForReply: (msg) => ({ id: msg.wamid, message: msg?.text?.body }), }, image: { @@ -719,10 +719,12 @@ export const parseRenderMessageList = (messages) => { waError = whatsappError.INVALID_PHONE_NUMBER; } } + const msgTypeData = whatsappMsgTypeMapped?.[msgType]?.data(msgContent) || {}; return { ...msg, msgOrigin: { ...msgContent, ...msgContent.email }, - ...(whatsappMsgTypeMapped?.[msgType]?.data(msgContent) || {}), + // id: msg.id || msgContent.wamid || msgContent.id, + ...msgTypeData, type: msgContent.type, ...(typeof whatsappMsgTypeMapped[msgType].type === 'function' ? whatsappMsgTypeMapped[msgType].type(msg) : { type: whatsappMsgTypeMapped[msgType].type || 'text' }), date: msg.msgtime, // msgContent?.sendTime || msg.msgtime || '', @@ -743,7 +745,7 @@ export const parseRenderMessageList = (messages) => { dateString: msgStatusRenderMapped[msgContent?.status || 'failed'] === 'failed' ? `${(msg.msgtime || '').replace('T', ' ')} 发送失败 ${waError} ❌` : '', statusCN: msgStatusRenderMappedCN[msgContent?.status || 'failed'], statusTitle: msgStatusRenderMappedCN[msgContent?.status || 'failed'], - id: (msgContent?.status || 'failed') === 'failed' ? msgContent.actionId : msg.id, + id: (msgContent?.status || 'failed') === 'failed' ? msgContent.actionId : (msgTypeData.id || msg.id), actionId: msgContent.actionId, replyButton: !['waiting', 'failed'].includes(msgContent?.status || 'failed') , }