diff --git a/sdk/state/Conversation.class.js b/sdk/state/Conversation.class.js index 819f9bc9898f8c080243b10fe4f50f5bbac9a9b4..f57607e99eb46b14d531995fc5c0eef5cefb07a8 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 b8c37752cb6b7b283b54e82886aee265720621c3..ff11cb5469f2674ce174c5e05ee85d276c12883f 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)