From 4730258ff25621cd368d806939574c2f9a165b3b Mon Sep 17 00:00:00 2001 From: ljw <1910244583@qq.com> Date: Wed, 31 May 2023 21:06:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloudfunctions/fe-team-leaveTeam/index.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-leaveTeam/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-leaveTeam/index.js index 0895584..da3b08a 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-leaveTeam/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-leaveTeam/index.js @@ -40,12 +40,16 @@ exports.main = async (event, context) => { if (tmp.affectedDocs == 1) { const collection1 = db.collection('mustgo-team') const res1 = await collection1.doc(teamid).remove() + + const tmp2 = await activitycollection.where({ + team_id:teamid + }).remove() } const res = await collection.doc(event.userId).update({ team_id: "" }) - if (res.updated === 1) { + if (res.updated === 1 && res1.affectedDocs != 1) { const activity = db.collection('mustgo-team-activity') let res2 = await activity.where({ @@ -64,6 +68,12 @@ exports.main = async (event, context) => { }).remove() } + return { + "code": 200, + "message": "退出小队成功", + "data": {} + } + } else { return { "code": 200, "message": "退出小队成功", -- GitLab