From 4a3ac4247cac02b673d0c86ecc1172c4d7f2ac27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?052004122=E6=B8=A9=E5=AE=B8=E6=9D=B0?= <734868971@qq.com> Date: Thu, 25 May 2023 13:00:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E7=B3=BB?= =?UTF-8?q?=E7=BB=9F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js_sdk/validator/mustgo-running-record.js | 2 +- .../content/mustgo-record/running/edit.vue | 35 +++++++++++++------ .../content/mustgo-record/walking/edit.vue | 26 ++++++++++---- .../admin/pages/content/mustgo-user/edit.vue | 4 +-- .../cloudfunctions/fe-team-leaveTeam/index.js | 31 ++++++++++++++-- 5 files changed, 76 insertions(+), 22 deletions(-) diff --git a/alpha/admin/js_sdk/validator/mustgo-running-record.js b/alpha/admin/js_sdk/validator/mustgo-running-record.js index 44dee27..6c567aa 100644 --- a/alpha/admin/js_sdk/validator/mustgo-running-record.js +++ b/alpha/admin/js_sdk/validator/mustgo-running-record.js @@ -5,7 +5,7 @@ const validator = { "start_date": { "rules": [ { - "format": "string" + "format": "datetime" } ], "title": "开始时间", diff --git a/alpha/admin/pages/content/mustgo-record/running/edit.vue b/alpha/admin/pages/content/mustgo-record/running/edit.vue index 4776a3d..a3aeda5 100644 --- a/alpha/admin/pages/content/mustgo-record/running/edit.vue +++ b/alpha/admin/pages/content/mustgo-record/running/edit.vue @@ -2,22 +2,30 @@ - + - + + - + + - - + + - + + - + + + - + + - + + - + - + + - + + - + - + 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 cf0fffc..33a7902 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-leaveTeam/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-leaveTeam/index.js @@ -2,7 +2,7 @@ exports.main = async (event, context) => { const db = uniCloud.database() const collection = db.collection('mustgo-user') - + let res1 = await collection.where({ _id: event.userId }).get() @@ -17,24 +17,49 @@ exports.main = async (event, context) => { if (res1.affectedDocs == 1) { teamid = res1.data[0]["team_id"] } - if(teamid == "") { + if (teamid == "") { return { "code": 400, "message": "退出小队失败", "data": {} } } - + let res = await collection.where({ _id: event.userId, team_id: teamid }).get() if (res.affectedDocs == 1) { + + let tmp = await collection.where({ + team_id: teamid + }).get() + if (tmp.affectedDocs == 1) { + const collection1 = db.collection('mustgo-team') + const res1 = await collection1.doc(teamid).remove() + } + const res = await collection.doc(event.userId).update({ team_id: "" }) 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') + for (var i = 0; i < arr.length; i++) { + const tmp = await registration.where({ + team_activity_id: arr[i]["_id"] + }).remove() + + // doc(`${id}`).update({team_activity_id:{name:dbCmd.remove()}}) + } + return { "code": 200, "message": "退出小队成功", -- GitLab