From c7ea2fb999dd3437a442e32526ea112d255d88bb Mon Sep 17 00:00:00 2001 From: ljw <1910244583@qq.com> Date: Mon, 29 May 2023 21:38:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fe-team-activityDetail/index.js | 50 ++++++++++++++++--- 1 file changed, 43 insertions(+), 7 deletions(-) diff --git a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-activityDetail/index.js b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-activityDetail/index.js index 3109188..9dd23e9 100644 --- a/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-activityDetail/index.js +++ b/alpha/admin/uniCloud-aliyun/cloudfunctions/fe-team-activityDetail/index.js @@ -23,6 +23,45 @@ exports.main = async (event, context) => { team_activity_id: event.activityId, owner_id: event.userId }).get() + + + var date = new Date(); + var month = date.getMonth() + 1; + if(month < 10) + month = "0"+month; + var day = date.getDate(); + if(day < 10) + day = "0"+day; + var hours = date.getHours(); + if (hours < 10) + hours = "0" + hours; + var minutes = date.getMinutes(); + if (minutes < 10) + minutes = "0" + minutes; + var time = date.getFullYear() + "-" + month + "-" + day + + " " + hours + ":" + minutes; + + // return time + + if (time>res.data[0]["start_date"] ) { + return { + code: 200, + message: "成功返回活动详情", + qualification: "报名时间截止", + data: { + "username": username, + "icon": icon, + "content": res.data[0]["content"], + "startDate": res.data[0]["start_date"], + "endDate": res.data[0]["end_date"], + "place": res.data[0]["place"], + "participants": res.data[0]["participants"], + "contact": res.data[0]["contact"], + "enrollment": res.data[0]["enrollment"] + } + } + } + if (res2.affectedDocs == 1) { return { code: 200, @@ -37,14 +76,11 @@ exports.main = async (event, context) => { "place": res.data[0]["place"], "participants": res.data[0]["participants"], "contact": res.data[0]["contact"], - "enrollment":res.data[0]["enrollment"] + "enrollment": res.data[0]["enrollment"] } } } - - // console.log(res.date[0]["participants"]) - // console.log(res.date[0]["enrollment"]) if (res.data[0]["participants"] <= res.data[0]["enrollment"]) { return { code: 200, @@ -59,11 +95,11 @@ exports.main = async (event, context) => { "place": res.data[0]["place"], "participants": res.data[0]["participants"], "contact": res.data[0]["contact"], - "enrollment":res.data[0]["enrollment"] + "enrollment": res.data[0]["enrollment"] } } } - + return { code: 200, message: "成功返回活动详情", @@ -77,7 +113,7 @@ exports.main = async (event, context) => { "place": res.data[0]["place"], "participants": res.data[0]["participants"], "contact": res.data[0]["contact"], - "enrollment":res.data[0]["enrollment"] + "enrollment": res.data[0]["enrollment"] } } -- GitLab