From 48f595225bd98885c0d61e8a6d2f4daf59831a59 Mon Sep 17 00:00:00 2001 From: MicroMilo Date: Wed, 31 May 2023 20:09:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=90=E5=8A=A8=E6=8E=A5=E5=8F=A3=20bug=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cloudfunctions/fe-sport-object/index.obj.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js index d591335..f50ac69 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-sport-object/index.obj.js @@ -130,9 +130,16 @@ module.exports = { let cur = res.data[0][fieldName]; cur += event.distance - res = await collection.doc(event.userId).update({ - total_walking_distance: cur, - }) + if (event.type == "跑步") { + res = await collection.doc(event.userId).update({ + total_running_distance: cur + }) + } else { + res = await collection.doc(event.userId).update({ + total_walking_distance: cur + }) + } + if (res.updated > 0) return { -- GitLab