debug: emoji in json

dev/chat
Lei OT 2 years ago
parent b35088fd7a
commit bc31645153

@ -462,7 +462,12 @@ export const parseRenderMessageItem = (msg) => {
*/
export const parseRenderMessageList = (messages, conversationid = null) => {
return messages.map((msg, i) => {
const msgContent = msg.msgtext_AsJOSN;
let msgContentString = '';
if (typeof msg.msgtext_AsJOSN === 'string') {
// debug: json 缺少一部分
msgContentString = msg.msgtext_AsJOSN.charAt(msg.msgtext_AsJOSN.length - 1) !== '}' ? msg.msgtext_AsJOSN + '}}' : msg.msgtext_AsJOSN;
}
const msgContent = typeof msg.msgtext_AsJOSN === 'string' ? JSON.parse(msgContentString) : msg.msgtext_AsJOSN;
msgContent.template = msg.msgtype === 'template' ? { ...msgContent.template, ...msg.template_AsJOSN } : {};
const msgType = Object.keys(whatsappMsgTypeMapped).includes(msgContent.type) ? msgContent.type : 'unsupported';
// const parseMethod = msgContent.bizType === 'whatsapp' ? cloneDeep(whatsappMsgTypeMapped) : {};

Loading…
Cancel
Save