feat(接口更新): 將多個API請求從request轉為request2,並調整相關邏輯以支持新結構,優化代碼可讀性。同時,更新了聊天記錄的排序邏輯,根據未讀消息數量和時間進行排序,提升用戶體驗。

This commit is contained in:
2025-09-23 14:34:19 +08:00
parent 0eb6716263
commit 3a90b1d163
4 changed files with 65 additions and 61 deletions

View File

@@ -141,7 +141,16 @@ export const useWeChatStore = create<WeChatState>()(
const state = useWeChatStore.getState();
// 切换联系人时清空当前消息,等待重新加载
set({ currentMessages: [], openTransmitModal: false });
clearUnreadCount([contract.id]).then(() => {
const params: any = {};
if (!contract.chatroomId) {
params.wechatFriendId = contract.id;
} else {
params.wechatChatroomId = contract.id;
}
clearUnreadCount(params).then(() => {
if (isExist) {
updateChatSession({
...contract,