From 97b7f98e116e969a71d2bba8bfc74096b7d12244 Mon Sep 17 00:00:00 2001 From: MicroMilo Date: Wed, 10 May 2023 09:11:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=97=B4=E8=B0=8Dbug?= =?UTF-8?q?=EF=BC=88=E9=9B=BE=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloudfunctions/fe-my-runningDetail/index.js | 6 +++++- .../cloudfunctions/fe-sport-run-save/index.js | 9 +++++++++ .../cloudfunctions/fe-sport-walk-save/index.js | 11 ++++++++++- .../cloudfunctions/fe-team-joinTeam/index.js | 14 ++++++++++++-- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-my-runningDetail/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-my-runningDetail/index.js index 60b4707..8d40301 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-my-runningDetail/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-my-runningDetail/index.js @@ -14,7 +14,11 @@ exports.main = async (event, context) => { "duration": res.data[0]["duration"], "pace": res.data[0]["pace"], "StartDatetime": res.data[0]["start_date"], - "feeling": res.data[0]["feelings"] + "feeling": res.data[0]["feelings"], + "startPoint": res.data[0]["start_point"], + "endPoint": res.data[0]["end_point"], + "pathLine": res.data[0]["path_line"] + } } } diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js index 514d10e..9cbfbaf 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-run-save/index.js @@ -6,6 +6,15 @@ exports.main = async (event, context) => { const db = uniCloud.database(); let collection = db.collection('mustgo-running-record'); + if (event.distance < 0.01) { + return { + code: 400, + message: "距离过短,不予保存", + data: { + } + } + } + let res = await collection.add({ start_date: event.startTime, duration: event.duration, diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js index 553c3bf..52ad85c 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-walk-save/index.js @@ -6,10 +6,19 @@ exports.main = async (event, context) => { const db = uniCloud.database(); let collection = db.collection('mustgo-walking-record'); + if (event.distance < 0.01) { + return { + code: 400, + message: "距离过短,不予保存", + data: { + } + } + } + let res = await collection.add({ start_date: event.startTime, duration: event.duration, - // feelings: event.feelings, + feelings: "", owner_id: event.userId, distance: event.distance, pace: event.pace, diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-joinTeam/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-joinTeam/index.js index 2c42002..43b1ae8 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-joinTeam/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-joinTeam/index.js @@ -6,8 +6,18 @@ exports.main = async (event, context) => { let teamres = await teamcollection.where({ _id: event.teamId }).get() - + if (teamres.affectedDocs == 1) { + let userres = await collection.where({ + _id: event.userId + }).get() + if(userres.data[0]["team_id"] != "") { + return { + "code": 400, + "message": "加入小队失败", + "data": {} + } + } const res = await collection.doc(event.userId).update({ team_id: event.teamId }) @@ -28,4 +38,4 @@ exports.main = async (event, context) => { "message": "加入小队失败", "data": {} } -}; \ No newline at end of file +}; -- GitLab