提交 a2811185 编写于 作者: DCloud_JSON's avatar DCloud_JSON

修复 本地不存在的会话收到 1 条消息,角标会+2 的问题

上级 acaaa53a
...@@ -61,7 +61,12 @@ msgEvent.onMsg(async res=>{ ...@@ -61,7 +61,12 @@ msgEvent.onMsg(async res=>{
} = msg } = msg
// console.log('msgmsgmsgmsgmsg.msg',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') { if (msg.type == 'clear-conversation-unreadCount') {
...@@ -126,7 +131,9 @@ msgEvent.onMsg(async res=>{ ...@@ -126,7 +131,9 @@ msgEvent.onMsg(async res=>{
isReadableMsg && isReadableMsg &&
// 消息不是系统配置了免打扰的 // 消息不是系统配置了免打扰的
!isMuteMsg && !isMuteMsg &&
msg.from_uid != uniCloud.getCurrentUserInfo().uid msg.from_uid != uniCloud.getCurrentUserInfo().uid &&
// 新创建的会话直接读取云端的未读消息数,本地不需要 ++
!isNewCreateConversation
) { ) {
conversation.unread_count++ conversation.unread_count++
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册