feat(未讀消息數據結構優化): 更新多個接口和數據結構,將unreadCount移入config對象中,並調整相關邏輯以支持新結構,提升代碼可讀性和維護性。

This commit is contained in:
2025-09-23 11:51:14 +08:00
parent 8742560e6c
commit 92242bb8ff
9 changed files with 61 additions and 60 deletions

View File

@@ -143,7 +143,10 @@ export const useWeChatStore = create<WeChatState>()(
set({ currentMessages: [], openTransmitModal: false });
clearUnreadCount([contract.id]).then(() => {
if (isExist) {
updateChatSession({ ...contract, unreadCount: 0 });
updateChatSession({
...contract,
config: { unreadCount: 0 },
});
} else {
addChatSession(contract);
}

View File

@@ -392,7 +392,7 @@ export const useWebSocketStore = createPersistStore<WebSocketState>(
set({
messages: [...currentState.messages, newMessage],
unreadCount: currentState.unreadCount + 1,
unreadCount: currentState.config.unreadCount + 1,
});
//消息处理器
msgManageCore(data);