|
|
|
@ -79,7 +79,14 @@ const whatsappMsgMapped = {
|
|
|
|
|
// * 仅更新消息状态, 没有输出
|
|
|
|
|
return null;
|
|
|
|
|
},
|
|
|
|
|
contentToUpdate: (msgcontent) => ({ ...msgcontent, id: msgcontent.wamid, status: msgStatusRenderMapped[(msgcontent?.status || 'failed')], dateString: msgcontent.status==='failed' ? '发送失败 ❌' : '', }),
|
|
|
|
|
contentToUpdate: (msgcontent) => ({
|
|
|
|
|
...msgcontent,
|
|
|
|
|
...parseRenderMessageItem(msgcontent),
|
|
|
|
|
id: msgcontent.wamid,
|
|
|
|
|
status: msgStatusRenderMapped[(msgcontent?.status || 'failed')],
|
|
|
|
|
sender: 'me',
|
|
|
|
|
dateString: msgcontent.status==='failed' ? '发送失败 ❌' : '',
|
|
|
|
|
}),
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
export const msgStatusRenderMapped = {
|
|
|
|
@ -175,7 +182,7 @@ export const whatsappMsgTypeMapped = {
|
|
|
|
|
type: 'text',
|
|
|
|
|
data: (msg) => {
|
|
|
|
|
const templateDataMapped = msg.template?.components ? msg.template.components.reduce((r, v) => ({...r, [v.type]: v}), {}) : null;
|
|
|
|
|
return { id: msg.wamid, text: templateDataMapped?.body?.parameters?.[0]?.text || '', title: msg.template.name }
|
|
|
|
|
return { id: msg.wamid, text: templateDataMapped?.body?.text || templateDataMapped?.body?.parameters?.[0]?.text || '', title: msg.template.name }
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
@ -202,6 +209,7 @@ export const parseRenderMessageItem = (msg) => {
|
|
|
|
|
export const parseRenderMessageList = (messages, conversationid = null) => {
|
|
|
|
|
return messages.map((msg) => {
|
|
|
|
|
const msgContent = msg.msgtext_AsJOSN;
|
|
|
|
|
msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...msg.template_AsJOSN } : {};
|
|
|
|
|
const msgType = msgContent.type;
|
|
|
|
|
// const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {};
|
|
|
|
|
return {
|
|
|
|
|