feat(聊天会话更新): 优化聊天会话处理逻辑,简化未读消息清除和会话更新的代码结构,提高可读性和维护性。
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
// ==================== 消息加载方法 ====================
|
||||
|
||||
Reference in New Issue
Block a user