From a2811185a14c2d1f81b41ca0d5208bce218d6f52 Mon Sep 17 00:00:00 2001 From: DCloud_JSON Date: Mon, 17 Jun 2024 15:33:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E6=9C=AC=E5=9C=B0?= =?UTF-8?q?=E4=B8=8D=E5=AD=98=E5=9C=A8=E7=9A=84=E4=BC=9A=E8=AF=9D=E6=94=B6?= =?UTF-8?q?=E5=88=B0=201=20=E6=9D=A1=E6=B6=88=E6=81=AF=EF=BC=8C=E8=A7=92?= =?UTF-8?q?=E6=A0=87=E4=BC=9A+2=20=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/init/msgEvent.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sdk/init/msgEvent.js b/sdk/init/msgEvent.js index e8322cb..3ef2a51 100644 --- a/sdk/init/msgEvent.js +++ b/sdk/init/msgEvent.js @@ -61,7 +61,12 @@ msgEvent.onMsg(async res=>{ } = msg // console.log('msgmsgmsgmsgmsg.msg',msg); // 拿到收到消息的会话对象 - let conversation = await $state.conversation.get(conversation_id) + let conversation = $state.conversation.getCached(conversation_id) + let isNewCreateConversation = false + if (!conversation) { + isNewCreateConversation = true + conversation = await $state.conversation.get(conversation_id) + } // 处理其他设备已读某会话的情况 if (msg.type == 'clear-conversation-unreadCount') { @@ -126,7 +131,9 @@ msgEvent.onMsg(async res=>{ isReadableMsg && // 消息不是系统配置了免打扰的 !isMuteMsg && - msg.from_uid != uniCloud.getCurrentUserInfo().uid + msg.from_uid != uniCloud.getCurrentUserInfo().uid && + // 新创建的会话直接读取云端的未读消息数,本地不需要 ++ + !isNewCreateConversation ) { conversation.unread_count++ } -- GitLab