From 639ac025d9300c7bfc208622a1f5e86aba9e7d09 Mon Sep 17 00:00:00 2001 From: linju Date: Fri, 22 Nov 2024 17:10:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E9=83=A8=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=EF=BC=8C=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9A=84uni-id-users=E6=9F=A5=E8=AF=A2=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- uniCloud/cloudfunctions/uni-im-co/conversation.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/uniCloud/cloudfunctions/uni-im-co/conversation.js b/uniCloud/cloudfunctions/uni-im-co/conversation.js index 6a9af90..358c25b 100644 --- a/uniCloud/cloudfunctions/uni-im-co/conversation.js +++ b/uniCloud/cloudfunctions/uni-im-co/conversation.js @@ -209,11 +209,14 @@ async function getConversationList({ let friend_uids = res.data.map(item => item.friend_uid).filter(i => i) // 计算请求时间 startTime = Date.now() - let usersInfoRes = await dbJQL.collection('uni-id-users') - .where(`_id in ${JSON.stringify(friend_uids)}`) - .field('_id,avatar_file,nickname,realname_auth') - .limit(friend_uids.length) - .get() + let usersInfoRes = {data:[]} + if (friend_uids.length !== 0){ + usersInfoRes = await dbJQL.collection('uni-id-users') + .where(`_id in ${JSON.stringify(friend_uids)}`) + .field('_id,avatar_file,nickname,realname_auth') + .limit(friend_uids.length) + .get() + } // log请求时间 // console.error('get user耗时', Date.now() - startTime,startTime) -- GitLab