diff --git a/collection/uni-id-users/collection.json b/collection/uni-id-users/collection.json index d10f4be..9ea80c8 100644 --- a/collection/uni-id-users/collection.json +++ b/collection/uni-id-users/collection.json @@ -23,21 +23,32 @@ }, "gender": { "bsonType": "int", - "minimum": 0, - "maximum": 2, "title": "性别", - "description": "用户性别:0 未知 1 男性 2 女性" + "description": "用户性别:0 未知 1 男性 2 女性", + "defaultValue": 0, + "component": { + "name": "radio-group", + "childrenData": [{ + "label": "未知", + "value": 0 + }, { + "label": "男", + "value": 1 + }, { + "label": "女", + "value": 2 + }] + } }, "status": { "bsonType": "int", - "minimum": 0, - "maximum": 3, "description": "用户状态:0 正常 1 禁用 2 审核中 3 审核拒绝" }, "mobile": { "bsonType": "string", "title": "手机号码", - "description": "手机号码" + "description": "手机号码", + "pattern": "^\\+?[0-9-]{3,20}$" }, "mobile_confirmed": { "bsonType": "int", @@ -47,6 +58,7 @@ }, "email": { "bsonType": "string", + "format": "email", "title": "邮箱", "description": "邮箱地址" }, @@ -161,7 +173,7 @@ "bsonType": "string", "description": "注册时 IP 地址", "forceDefaultValue": { - "$env": "ip" + "$env": "clientIP" } }, "last_login_date": { diff --git a/collection/uni-verify/collection.json b/collection/uni-verify/collection.json new file mode 100644 index 0000000..54669b7 --- /dev/null +++ b/collection/uni-verify/collection.json @@ -0,0 +1,68 @@ +{ + "schema": { + "bsonType": "object", + "required": [], + "properties": { + "_id": { + "description": "ID,系统自动生成" + }, + "mobile": { + "bsonType": "string", + "description": "手机号码" + }, + "email": { + "bsonType": "string", + "description": "邮箱" + }, + "code": { + "bsonType": "string", + "description": "验证码" + }, + "type": { + "bsonType": "string", + "description": "验证类型:login, bind, unbind, pay" + }, + "state": { + "bsonType": "int", + "description": "验证状态:0 未验证、1 已验证、2 已作废" + }, + "ip": { + "bsonType": "string", + "description": "请求时客户端IP地址" + }, + "created_at": { + "bsonType": "timestamp", + "description": "创建时间" + }, + "expired_at": { + "bsonType": "timestamp", + "description": "过期时间" + } + } + }, + "index": [{ + "IndexName": "mobile_code_", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "mobile", + "Direction": "1" + }, { + "Name": "code", + "Direction": "1" + }], + "MgoIsUnique": false + } + }, { + "IndexName": "email_code_", + "MgoKeySchema": { + "MgoIndexKeys": [{ + "Name": "email", + "Direction": "1" + }, { + "Name": "code", + "Direction": "1" + }], + "MgoIsUnique": false + } + }] +} diff --git a/collection/uni-verify/package.json b/collection/uni-verify/package.json new file mode 100644 index 0000000..706b007 --- /dev/null +++ b/collection/uni-verify/package.json @@ -0,0 +1,17 @@ +{ + "name": "@opendb/uni-verify", + "version": "0.0.1", + "description": "uni-verify 验证码", + "keywords": ["验证码"], + "opendb": { + "title": "验证码", + "type": "collection", + "contributors": [ + { + "name": "DCloud", + "email": "", + "homepage": "https://gitee.com/dcloud/opendb" + } + ] + } +}