feat(聊天会话更新): 优化聊天会话处理逻辑,简化未读消息清除和会话更新的代码结构,提高可读性和维护性。

This commit is contained in:
超级老白兔
2025-09-23 14:40:36 +08:00
parent 3a90b1d163
commit 4c2c3db052

View File

@@ -150,22 +150,21 @@ export const useWeChatStore = create<WeChatState>()(
params.wechatChatroomId = contract.id;
}
clearUnreadCount(params).then(() => {
if (isExist) {
updateChatSession({
...contract,
config: { unreadCount: 0 },
});
} else {
addChatSession(contract);
}
set({ currentContract: contract });
updateConfig({
id: contract.id,
config: { chat: true },
clearUnreadCount(params);
if (isExist) {
updateChatSession({
...contract,
config: { unreadCount: 0 },
});
state.loadChatMessages(true, 4704624000000);
} else {
addChatSession(contract);
}
set({ currentContract: contract });
updateConfig({
id: contract.id,
config: { chat: true },
});
state.loadChatMessages(true, 4704624000000);
},
// ==================== 消息加载方法 ====================