perf: 图片和文本消息统一状态处理

dev/supplier-email-drawer
LiaoYijun 9 months ago
parent d39d5f4da0
commit 801de4cb96

@ -93,6 +93,7 @@ const createWhatsApp = async phone => {
const msgDirection = msg.key.fromMe ? 'outbound' : 'inbound';
const msgFrom = msg.key.fromMe ? whatsAppNo : remoteNo;
const msgTo = msg.key.fromMe ? remoteNo : whatsAppNo;
const msgStatus = msg.status === undefined ? '' : formatStatus(msg.status);
if (msg.message?.conversation || msg.message?.extendedTextMessage?.text) {
@ -101,7 +102,7 @@ const createWhatsApp = async phone => {
waEmitter.emit(emitEventName, {
id: msg.key.id,
externalId,
status: formatStatus(msg.status),
status: msgStatus,
direction: msgDirection,
from: msgFrom,
to: msgTo,
@ -131,8 +132,6 @@ const createWhatsApp = async phone => {
const imageFilename = './temp/image_' + whatsAppNo + '_' + msg.key.id + fileExtension;
await writeFile(imageFilename, imageBuffer);
const msgStatus = msg.status === undefined ? '' : formatStatus(msg.status);
waEmitter.emit(emitEventName, {
id: msg.key.id,
externalId,

Loading…
Cancel
Save