From 23078bb8dcbf8d04e60a97ab3ad783c1db27b1d7 Mon Sep 17 00:00:00 2001 From: linju Date: Wed, 13 Nov 2024 21:07:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E6=8D=95=E8=8E=B7Conversa?= =?UTF-8?q?tionItem=E5=88=9B=E5=BB=BA=E9=94=99=E8=AF=AF=EF=BC=8C=E5=B9=B6?= =?UTF-8?q?=E4=B8=8A=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/state/Conversation.class.js | 16 ++++++++++------ sdk/state/ConversationItem.class.js | 5 +++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sdk/state/Conversation.class.js b/sdk/state/Conversation.class.js index f57607e..41fc0f3 100644 --- a/sdk/state/Conversation.class.js +++ b/sdk/state/Conversation.class.js @@ -129,12 +129,16 @@ export default class Conversation extends CloudData { // console.log('新增会话', item) // 插入客户端创建此会话的时间 item.client_create_time = Date.now() - let conversation = new ConversationItem(item) - // console.log('新增会话', conversation) - const usersInfo = conversation.getUsersInfo() - // 把会话相关的用户信息合并到 $users - $users.merge(usersInfo) - resList.push(conversation) + try{ + let conversation = new ConversationItem(item) + // console.log('新增会话', conversation) + const usersInfo = conversation.getUsersInfo() + // 把会话相关的用户信息合并到 $users + $users.merge(usersInfo) + resList.push(conversation) + }catch(e){ + $utils.reportError(e) + } return resList }, []) } diff --git a/sdk/state/ConversationItem.class.js b/sdk/state/ConversationItem.class.js index f9c68ac..fba6875 100644 --- a/sdk/state/ConversationItem.class.js +++ b/sdk/state/ConversationItem.class.js @@ -11,8 +11,9 @@ class ConversationItem { constructor(data) { // 检查是否关联用户/群被删除 if (!data.group_id && !data.user_info) { - console.error(JSON.stringify(data)); - throw new Error('会话列表失效,疑似关联用户/群被删除(请改为软删除避免系统异常)'); + // 删除本地生成的 data.client_create_time 避免错误重复上报 + delete data.client_create_time + throw new Error('会话列表失效,疑似关联用户/群被删除(请改为软删除避免系统异常)data:'+JSON.stringify(data)); } // 对话框消息内容 this.chatInputContent = "" -- GitLab