提交 e84fe253 编写于 作者: M MicroMilo

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

......@@ -23,7 +23,7 @@ const validator = {
"likes": {
"rules": [
{
"format": "int"
format: "Number"
}
],
"title": "点赞数",
......@@ -49,8 +49,13 @@ const validator = {
},
"content": {
"rules": [
{
required:true,
errorMessage:"请输入内容",
},
{
"format": "string"
format: "string",
errorMessage:"请输入正确的内容格式",
}
],
"title": "评论内容",
......
......@@ -5,7 +5,12 @@ const validator = {
"content": {
"rules": [
{
"format": "string"
required:true,
errorMessage:"请输入内容",
},
{
format:"string",
errorMessage:"请输入正确的内容格式",
}
],
"title": "内容",
......
......@@ -5,8 +5,13 @@ const validator = {
"title": {
"rules": [
{
"format": "string"
}
required:true,
errorMessage:"请输入标题",
},
{
format: "string",
errorMessage:"请输入正确的标题格式",
}
],
"title": "标题",
"label": "标题"
......@@ -14,8 +19,13 @@ const validator = {
"content": {
"rules": [
{
"format": "string"
}
required:true,
errorMessage:"请输入内容",
},
{
format: "string",
errorMessage:"请输入正确的内容格式",
}
],
"title": "内容",
"label": "内容"
......@@ -23,7 +33,7 @@ const validator = {
"start_date": {
"rules": [
{
"format": "datetime"
format: "datetime"
}
],
"title": "开始时间",
......@@ -32,7 +42,7 @@ const validator = {
"end_date": {
"rules": [
{
"format": "datetime"
}
],
"title": "结束时间",
......@@ -41,7 +51,7 @@ const validator = {
"owner_id": {
"rules": [
{
"format": "string"
format: "string"
}
],
"title": "发布者id",
......@@ -50,7 +60,7 @@ const validator = {
"background_picture": {
"rules": [
{
"format": "string"
format: "string"
}
],
"title": "背景图片",
......@@ -59,7 +69,12 @@ const validator = {
"place": {
"rules": [
{
"format": "string"
required:true,
errorMessage:"请输入地点",
},
{
format: "string",
errorMessage:"请输入正确的地点格式",
}
],
"title": "地点",
......@@ -68,7 +83,7 @@ const validator = {
"status": {
"rules": [
{
"format": "int"
format: "number"
}
],
"title": "活动状态",
......@@ -77,17 +92,26 @@ const validator = {
"contact": {
"rules": [
{
"format": "^1[0-9]{10}$",
// "pattern": "^1[0-9]{10}$",
}
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": "联系方式",
"label": "联系方式"
},
"invitee": {
"rules": [
{
required:true,
errorMessage:"请输入面向对象",
},
{
"format": "string"
format: "string",
errorMessage:"请输入正确的面向对象格式",
}
],
"title": "面向对象",
......
......@@ -5,7 +5,12 @@ const validator = {
"title": {
"rules": [
{
"format": "string"
required:true,
errorMessage:"请输入标题",
},
{
format: "string",
errorMessage:"请输入正确的标题格式",
}
],
"title": "标题",
......@@ -14,7 +19,12 @@ const validator = {
"content": {
"rules": [
{
"format": "string"
required:true,
errorMessage:"请输入内容",
},
{
format: "string",
errorMessage:"请输入正确的内容格式",
}
],
"title": "内容",
......@@ -59,7 +69,12 @@ const validator = {
"place": {
"rules": [
{
"format": "string"
required:true,
errorMessage:"请输入地点",
},
{
format: "string",
errorMessage:"请输入正确的地点格式",
}
],
"title": "地点",
......@@ -77,7 +92,7 @@ const validator = {
"participants": {
"rules": [
{
"format": "int"
"format": "Number"
}
],
"title": "参与人数",
......@@ -86,8 +101,12 @@ const validator = {
"contact": {
"rules": [
{
"format": "string",
"pattern": "/^1[0-9]{10}$/",
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": "联系方式",
......
......@@ -5,7 +5,7 @@ const validator = {
"icon": {
"rules": [
{
"format": "string"
format: "string"
}
],
"title": "队标",
......@@ -13,9 +13,14 @@ const validator = {
},
"name": {
"rules": [
{
"format": "string"
}
{
required:true,
errorMessage:"请输入队名",
},
{
format: "string",
errorMessage:"请输入正确的队名格式",
}
],
"title": "队名",
"label": "队名"
......@@ -32,7 +37,12 @@ const validator = {
"description": {
"rules": [
{
"format": "string"
required:true,
errorMessage:"请输入描述",
},
{
format: "string",
errorMessage:"请输入正确的格式",
}
],
"title": "描述",
......
......@@ -4,8 +4,13 @@
const validator = {
"name": {
"rules": [
{
required:true,
errorMessage:"请输入用户名",
},
{
"format": "string"
maxLength:15,
errorMessage:"用户名过长",
}
],
"title": "姓名",
......@@ -14,7 +19,7 @@ const validator = {
"icon": {
"rules": [
{
"format": "string"
format: "string"
}
],
"title": "头像",
......@@ -24,7 +29,7 @@ const validator = {
"gender": {
"rules": [
{
"format": "string"
format: "string"
}
],
"title": "性别",
......@@ -33,8 +38,14 @@ const validator = {
"password": {
"rules": [
{
"format": "string"
}
required:true,
errorMessage:"请输入密码",
},
{
minLengt:8,
maxLength:20,
errorMessage:"密码长度在8到20位",
}
],
"title": "密码",
"label": "密码"
......@@ -42,7 +53,12 @@ const validator = {
"phone_num": {
"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": "手机号码",
......
......@@ -24,26 +24,10 @@ exports.main = async (event, context) => {
owner_id: event.userId
}).get()
var time = getSystemTime()
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"] ) {
if (time > res.data[0]["start_date"]) {
return {
code: 200,
message: "成功返回活动详情",
......@@ -85,7 +69,7 @@ exports.main = async (event, context) => {
return {
code: 200,
message: "成功返回活动详情",
qualification: "报名停止",
qualification: "活动人数已满",
data: {
"username": username,
"icon": icon,
......@@ -123,4 +107,31 @@ exports.main = async (event, context) => {
"message": "返回小队活动详情失败",
"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.
先完成此消息的编辑!
想要评论请 注册