提交 a758f13d 编写于 作者: L ljw

需修改

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