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 08955847b15652cc3d3cbaae11a0c8ca71d81297..da3b08a68be15adf30970606e8020c32717c5ab9 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": "退出小队成功",