提交 e84fe253 编写于 作者: M MicroMilo

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

...@@ -23,7 +23,7 @@ const validator = { ...@@ -23,7 +23,7 @@ const validator = {
"likes": { "likes": {
"rules": [ "rules": [
{ {
"format": "int" format: "Number"
} }
], ],
"title": "点赞数", "title": "点赞数",
...@@ -49,8 +49,13 @@ const validator = { ...@@ -49,8 +49,13 @@ const validator = {
}, },
"content": { "content": {
"rules": [ "rules": [
{
required:true,
errorMessage:"请输入内容",
},
{ {
"format": "string" format: "string",
errorMessage:"请输入正确的内容格式",
} }
], ],
"title": "评论内容", "title": "评论内容",
......
...@@ -5,7 +5,12 @@ const validator = { ...@@ -5,7 +5,12 @@ const validator = {
"content": { "content": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入内容",
},
{
format:"string",
errorMessage:"请输入正确的内容格式",
} }
], ],
"title": "内容", "title": "内容",
......
...@@ -5,8 +5,13 @@ const validator = { ...@@ -5,8 +5,13 @@ const validator = {
"title": { "title": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
} errorMessage:"请输入标题",
},
{
format: "string",
errorMessage:"请输入正确的标题格式",
}
], ],
"title": "标题", "title": "标题",
"label": "标题" "label": "标题"
...@@ -14,8 +19,13 @@ const validator = { ...@@ -14,8 +19,13 @@ const validator = {
"content": { "content": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
} errorMessage:"请输入内容",
},
{
format: "string",
errorMessage:"请输入正确的内容格式",
}
], ],
"title": "内容", "title": "内容",
"label": "内容" "label": "内容"
...@@ -23,7 +33,7 @@ const validator = { ...@@ -23,7 +33,7 @@ const validator = {
"start_date": { "start_date": {
"rules": [ "rules": [
{ {
"format": "datetime" format: "datetime"
} }
], ],
"title": "开始时间", "title": "开始时间",
...@@ -32,7 +42,7 @@ const validator = { ...@@ -32,7 +42,7 @@ const validator = {
"end_date": { "end_date": {
"rules": [ "rules": [
{ {
"format": "datetime"
} }
], ],
"title": "结束时间", "title": "结束时间",
...@@ -41,7 +51,7 @@ const validator = { ...@@ -41,7 +51,7 @@ const validator = {
"owner_id": { "owner_id": {
"rules": [ "rules": [
{ {
"format": "string" format: "string"
} }
], ],
"title": "发布者id", "title": "发布者id",
...@@ -50,7 +60,7 @@ const validator = { ...@@ -50,7 +60,7 @@ const validator = {
"background_picture": { "background_picture": {
"rules": [ "rules": [
{ {
"format": "string" format: "string"
} }
], ],
"title": "背景图片", "title": "背景图片",
...@@ -59,7 +69,12 @@ const validator = { ...@@ -59,7 +69,12 @@ const validator = {
"place": { "place": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入地点",
},
{
format: "string",
errorMessage:"请输入正确的地点格式",
} }
], ],
"title": "地点", "title": "地点",
...@@ -68,7 +83,7 @@ const validator = { ...@@ -68,7 +83,7 @@ const validator = {
"status": { "status": {
"rules": [ "rules": [
{ {
"format": "int" format: "number"
} }
], ],
"title": "活动状态", "title": "活动状态",
...@@ -77,17 +92,26 @@ const validator = { ...@@ -77,17 +92,26 @@ const validator = {
"contact": { "contact": {
"rules": [ "rules": [
{ {
"format": "^1[0-9]{10}$", required:true,
// "pattern": "^1[0-9]{10}$", errorMessage:"请输入联系方式",
} },
{
pattern:/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
errorMessage:"请输入正确的联系方式",
}
], ],
"title": "联系方式", "title": "联系方式",
"label": "联系方式" "label": "联系方式"
}, },
"invitee": { "invitee": {
"rules": [ "rules": [
{
required:true,
errorMessage:"请输入面向对象",
},
{ {
"format": "string" format: "string",
errorMessage:"请输入正确的面向对象格式",
} }
], ],
"title": "面向对象", "title": "面向对象",
......
...@@ -5,7 +5,12 @@ const validator = { ...@@ -5,7 +5,12 @@ const validator = {
"title": { "title": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入标题",
},
{
format: "string",
errorMessage:"请输入正确的标题格式",
} }
], ],
"title": "标题", "title": "标题",
...@@ -14,7 +19,12 @@ const validator = { ...@@ -14,7 +19,12 @@ const validator = {
"content": { "content": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入内容",
},
{
format: "string",
errorMessage:"请输入正确的内容格式",
} }
], ],
"title": "内容", "title": "内容",
...@@ -59,7 +69,12 @@ const validator = { ...@@ -59,7 +69,12 @@ const validator = {
"place": { "place": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入地点",
},
{
format: "string",
errorMessage:"请输入正确的地点格式",
} }
], ],
"title": "地点", "title": "地点",
...@@ -77,7 +92,7 @@ const validator = { ...@@ -77,7 +92,7 @@ const validator = {
"participants": { "participants": {
"rules": [ "rules": [
{ {
"format": "int" "format": "Number"
} }
], ],
"title": "参与人数", "title": "参与人数",
...@@ -86,8 +101,12 @@ const validator = { ...@@ -86,8 +101,12 @@ const validator = {
"contact": { "contact": {
"rules": [ "rules": [
{ {
"format": "string", required:true,
"pattern": "/^1[0-9]{10}$/", errorMessage:"请输入联系方式",
},
{
pattern:/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
errorMessage:"请输入正确的联系方式",
} }
], ],
"title": "联系方式", "title": "联系方式",
......
...@@ -5,7 +5,7 @@ const validator = { ...@@ -5,7 +5,7 @@ const validator = {
"icon": { "icon": {
"rules": [ "rules": [
{ {
"format": "string" format: "string"
} }
], ],
"title": "队标", "title": "队标",
...@@ -13,9 +13,14 @@ const validator = { ...@@ -13,9 +13,14 @@ const validator = {
}, },
"name": { "name": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
} errorMessage:"请输入队名",
},
{
format: "string",
errorMessage:"请输入正确的队名格式",
}
], ],
"title": "队名", "title": "队名",
"label": "队名" "label": "队名"
...@@ -32,7 +37,12 @@ const validator = { ...@@ -32,7 +37,12 @@ const validator = {
"description": { "description": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入描述",
},
{
format: "string",
errorMessage:"请输入正确的格式",
} }
], ],
"title": "描述", "title": "描述",
......
...@@ -4,8 +4,13 @@ ...@@ -4,8 +4,13 @@
const validator = { const validator = {
"name": { "name": {
"rules": [ "rules": [
{
required:true,
errorMessage:"请输入用户名",
},
{ {
"format": "string" maxLength:15,
errorMessage:"用户名过长",
} }
], ],
"title": "姓名", "title": "姓名",
...@@ -14,7 +19,7 @@ const validator = { ...@@ -14,7 +19,7 @@ const validator = {
"icon": { "icon": {
"rules": [ "rules": [
{ {
"format": "string" format: "string"
} }
], ],
"title": "头像", "title": "头像",
...@@ -24,7 +29,7 @@ const validator = { ...@@ -24,7 +29,7 @@ const validator = {
"gender": { "gender": {
"rules": [ "rules": [
{ {
"format": "string" format: "string"
} }
], ],
"title": "性别", "title": "性别",
...@@ -33,8 +38,14 @@ const validator = { ...@@ -33,8 +38,14 @@ const validator = {
"password": { "password": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
} errorMessage:"请输入密码",
},
{
minLengt:8,
maxLength:20,
errorMessage:"密码长度在8到20位",
}
], ],
"title": "密码", "title": "密码",
"label": "密码" "label": "密码"
...@@ -42,7 +53,12 @@ const validator = { ...@@ -42,7 +53,12 @@ const validator = {
"phone_num": { "phone_num": {
"rules": [ "rules": [
{ {
"format": "string" required:true,
errorMessage:"请输入联系方式",
},
{
pattern:/^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/,
errorMessage:"请输入正确的联系方式",
} }
], ],
"title": "手机号码", "title": "手机号码",
......
...@@ -24,26 +24,10 @@ exports.main = async (event, context) => { ...@@ -24,26 +24,10 @@ exports.main = async (event, context) => {
owner_id: event.userId owner_id: event.userId
}).get() }).get()
var time = getSystemTime()
var date = new Date(); if (time > res.data[0]["start_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 { return {
code: 200, code: 200,
message: "成功返回活动详情", message: "成功返回活动详情",
...@@ -85,7 +69,7 @@ exports.main = async (event, context) => { ...@@ -85,7 +69,7 @@ exports.main = async (event, context) => {
return { return {
code: 200, code: 200,
message: "成功返回活动详情", message: "成功返回活动详情",
qualification: "报名停止", qualification: "活动人数已满",
data: { data: {
"username": username, "username": username,
"icon": icon, "icon": icon,
...@@ -123,4 +107,31 @@ exports.main = async (event, context) => { ...@@ -123,4 +107,31 @@ exports.main = async (event, context) => {
"message": "返回小队活动详情失败", "message": "返回小队活动详情失败",
"data": {} "data": {}
} }
}; };
\ No newline at end of file
function getSystemTime() {
// 实例化日期类
var time = new Date();
// 获取完整的年份(4位)
var year = time.getFullYear();
// 获取月份(0-11,0代表1月)
var month = time.getMonth() + 1;
if(month<10)
month = "0"+month
// 获取日期(1-31)
var date = time.getDate();
if(date<10)
date = "0"+date
// 获取小时
var h = time.getHours() + 8;
h = h < 10 ? '0' + h : h;
// 获取分钟
var m = time.getMinutes();
m = m < 10 ? '0' + m : m;
// 获取秒钟
var s = time.getSeconds();
s = s < 10 ? '0' + s : s;
// 合并返回
return(year + "-" + month + "-" + date + " " + h + ":" + m) ;
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册