提交 c7ea2fb9 编写于 作者: L ljw

完善接口

上级 81acf7d0
...@@ -23,6 +23,45 @@ exports.main = async (event, context) => { ...@@ -23,6 +23,45 @@ exports.main = async (event, context) => {
team_activity_id: event.activityId, team_activity_id: event.activityId,
owner_id: event.userId owner_id: event.userId
}).get() }).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) { if (res2.affectedDocs == 1) {
return { return {
code: 200, code: 200,
...@@ -37,14 +76,11 @@ exports.main = async (event, context) => { ...@@ -37,14 +76,11 @@ exports.main = async (event, context) => {
"place": res.data[0]["place"], "place": res.data[0]["place"],
"participants": res.data[0]["participants"], "participants": res.data[0]["participants"],
"contact": res.data[0]["contact"], "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"]) { if (res.data[0]["participants"] <= res.data[0]["enrollment"]) {
return { return {
code: 200, code: 200,
...@@ -59,11 +95,11 @@ exports.main = async (event, context) => { ...@@ -59,11 +95,11 @@ exports.main = async (event, context) => {
"place": res.data[0]["place"], "place": res.data[0]["place"],
"participants": res.data[0]["participants"], "participants": res.data[0]["participants"],
"contact": res.data[0]["contact"], "contact": res.data[0]["contact"],
"enrollment":res.data[0]["enrollment"] "enrollment": res.data[0]["enrollment"]
} }
} }
} }
return { return {
code: 200, code: 200,
message: "成功返回活动详情", message: "成功返回活动详情",
...@@ -77,7 +113,7 @@ exports.main = async (event, context) => { ...@@ -77,7 +113,7 @@ exports.main = async (event, context) => {
"place": res.data[0]["place"], "place": res.data[0]["place"],
"participants": res.data[0]["participants"], "participants": res.data[0]["participants"],
"contact": res.data[0]["contact"], "contact": res.data[0]["contact"],
"enrollment":res.data[0]["enrollment"] "enrollment": res.data[0]["enrollment"]
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册