提交 f7aae4ee 编写于 作者: M MicroMilo

Merge branch 'backend' of https://gitcode.net/qq_50679803/great-teamwork into backend

'use strict';
exports.main = async (event, context) => {
const db = uniCloud.database()
const collection = db.collection('mustgo-school-activity')
const res = await collection.doc(event.activityId).remove()
if (res.deleted === 1) {
return {
code: 200,
message: "删除活动成功"
}
} else {
return {
code: 500,
message: "删除活动失败"
}
}
};
\ No newline at end of file
{
"name": "fe-find-deleteActivity",
"dependencies": {},
"extensions": {
"uni-cloud-jql": {}
}
}
\ No newline at end of file
'use strict';
exports.main = async (event, context) => {
const db = uniCloud.database()
const usercollection = db.collection('mustgo-user')
let res1 = await usercollection.where({
_id: event.userId
}).get()
if (res1.affectedDocs <= 0) {
return {
"code": 400,
"message": "发起小队活动失败",
"data": {}
}
}
let teamid
if (res1.affectedDocs == 1) {
teamid = res1.data[0]["team_id"]
}
const collection = db.collection('mustgo-team-activity')
const res = await collection.add({
title: event.title,
......@@ -8,12 +25,11 @@ exports.main = async (event, context) => {
start_date: event.startDate,
end_date: event.endDate,
owner_id: event.userId,
background_picture: event.picture,
place: event.place,
status: 0,
participants: event.participants,
contact: event.contact,
team_id: event.teamId
team_id: teamid
})
if (res.id.length > 0)
return {
......
'use strict';
exports.main = async (event, context) => {
const db = uniCloud.database()
let ans
await db.collection('mustgo-team')
.where({
name: new RegExp(event.teamname, 'i') //模糊查询条件
})
.get()
.then((res) => {
// console.log(res)
ans = res
// res 为数据库查询结果
}).catch((err) => {
})
var list = new Array;
var arr = new Array;
arr = ans.data;
if (ans.affectedDocs >= 0) {
for (var i = 0; i < arr.length; i++) {
var team = {
teamId: arr[i]["_id"],
teamName: arr[i]["name"],
createrId: arr[i]["owner_id"],
discription: arr[i]["description"],
}
list.push(team);
}
return {
"code": 200,
"message": "成功返回小队列表",
"data": {
"teamList": list
}
}
}
return {
"code": 400,
"message": "返回小队列表失败",
"data": {}
}
};
\ No newline at end of file
{
"name": "fe-team-searchTeam",
"dependencies": {},
"extensions": {
"uni-cloud-jql": {}
}
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册