提交 a758f13d 编写于 作者: L ljw

需修改

上级 8698d9df
...@@ -49,37 +49,39 @@ exports.main = async (event, context) => { ...@@ -49,37 +49,39 @@ exports.main = async (event, context) => {
const res = await collection.doc(event.userId).update({ const res = await collection.doc(event.userId).update({
team_id: "" team_id: ""
}) })
if (res.updated === 1 && res1.affectedDocs != 1) { if (res.updated === 1) {
const activity = db.collection('mustgo-team-activity') const activity = db.collection('mustgo-team-activity')
let res2 = await activity.where({ let res2 = await activity.where({
team_id: teamid team_id: teamid
}).get() }).get()
var arr = new Array;
arr = res2.data
const registration = db.collection('mustgo-registration') const registration = db.collection('mustgo-registration')
let res3 = await registration.where({
owner_id: event.userId
}).get()
var arr = new Array;
arr = res3.data
for (var i = 0; i < arr.length; i++) { for (var i = 0; i < arr.length; i++) {
const res = await activitycollection.doc(arr[i]["_id"]).update({
enrollment: arr[i]["enrollment"]-1 let res4 = await activity.where({
_id:arr[i]["team_activity_id"]
}).get()
const res = await activitycollection.doc(arr[i]["team_activity_id"]).update({
enrollment: res4.data[0]["enrollment"] - 1
}) })
const tmp = await registration.where({ const restep = await registration.where({
team_activity_id: arr[i]["_id"] _id:arr[i]["_id"]
}).remove() }).remove()
} }
return { return {
"code": 200, "code": 200,
"message": "退出小队成功", "message": "退出小队成功",
"data": {} "data": {}
} }
} else { }
return {
"code": 200,
"message": "退出小队成功",
"data": {}
}
}
} }
return { return {
"code": 400, "code": 400,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册