messageData.updateSession和messageData.addMsgRecords都需要在session加载完之后才能执行,否则时机不对

This commit is contained in:
bob
2024-11-29 10:56:33 +08:00
parent 28c5b33652
commit cefcc4c189

View File

@@ -13,27 +13,26 @@ export const onReceiveSystemGroupCreateMsg = () => {
sessionId: sessionId
}).then((res) => {
messageData.addSession(res.data.data)
messageData.updateSession({
sessionId: sessionId,
lastMsgId: msg.body.msgId,
lastMsgType: msg.header.msgType,
lastMsgContent: msg.body.content,
lastMsgAccount: msg.body.fromId,
lastMsgTime: now
})
messageData.addMsgRecords(sessionId, [
{
sessionId: sessionId,
msgId: msg.body.msgId,
fromId: msg.body.fromId,
msgType: msg.header.msgType,
content: msg.body.content,
msgTime: now
}
])
})
}
messageData.updateSession({
sessionId: sessionId,
lastMsgId: msg.body.msgId,
lastMsgType: msg.header.msgType,
lastMsgContent: msg.body.content,
lastMsgAccount: msg.body.fromId,
lastMsgTime: now
})
messageData.addMsgRecords(sessionId, [
{
sessionId: sessionId,
msgId: msg.body.msgId,
fromId: msg.body.fromId,
msgType: msg.header.msgType,
content: msg.body.content,
msgTime: now
}
])
}
}