From 1a4fb12c8a343caaef63888ce7218c2a6c6a5d4d Mon Sep 17 00:00:00 2001 From: linju Date: Mon, 11 Nov 2024 15:24:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E9=80=9A=E8=BF=87group=5Fid=E6=9F=A5?= =?UTF-8?q?=E4=BA=91=E7=AB=AF=E4=BC=9A=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sdk/state/Conversation.class.js | 6 ++++-- uniCloud/cloudfunctions/uni-im-co/conversation.js | 7 ++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sdk/state/Conversation.class.js b/sdk/state/Conversation.class.js index 819f9bc..f57607e 100644 --- a/sdk/state/Conversation.class.js +++ b/sdk/state/Conversation.class.js @@ -198,7 +198,8 @@ export default class Conversation extends CloudData { // 已有会话id的情况下,不设置更新时间条件 let maxLastMsgCreateTime = false; let skip = 0; - if (!conversation_id) { + const group_id = param?.group_id + if (!conversation_id && !group_id) { // 会话列表的总数 const conversationCount = conversationDatas.length if(conversationCount !== 0){ @@ -226,7 +227,8 @@ export default class Conversation extends CloudData { skip, // 是否要区分是否为置顶会话 distinguishPinned: loadMoreType === 'all', - type:loadMoreType + type:loadMoreType, + group_id }) if (!conversation_id) { this.loadMore.lastConversation = {[loadMoreType]: res.data[res.data.length - 1]} diff --git a/uniCloud/cloudfunctions/uni-im-co/conversation.js b/uniCloud/cloudfunctions/uni-im-co/conversation.js index b8c3775..ff11cb5 100644 --- a/uniCloud/cloudfunctions/uni-im-co/conversation.js +++ b/uniCloud/cloudfunctions/uni-im-co/conversation.js @@ -20,6 +20,8 @@ async function getConversationList({ conversation_id = false, // 是否要区分是否为置顶 distinguishPinned = false, + // 群id + group_id = false, sort = { pinned: -1, last_msg_create_time: -1, @@ -66,7 +68,10 @@ async function getConversationList({ // 如果指定了会话id,则只查询指定的会话 if (conversation_id) { matchObj.id = conversation_id - } else { + } else if (group_id) { + matchObj.group_id = group_id + } + else { // 默认不查询置顶会话 if (distinguishPinned) { matchObj.pinned = dbCmd.neq(true) -- GitLab