UNPKG

mm_os

Version:

这是超级美眉服务端框架,用于快速构建应用程序。

131 lines (130 loc) 2.71 kB
{ // 是否启用过滤, 启用过滤后, 不符合的参数会被过滤掉 "filter": true, // 校验脚本文件, 可以使用脚本的方式加一步进行校验, 让传参更加安全 "func_file": "", // get请求 "get": { // 查询参数校验项 "query": ["uid", "name", "username", "phone", "email"], // 查询必填参数 "query_required": [] }, // post请求 "post": { // 查询参数校验项 "query": ["uid", "name", "username", "phone", "email"], // 查询必填参数 "query_required": [], // 正文参数校验项 "body": ["age", "headImg", "birthday", "password", "confirm_password", "pay_password"], // 正文必填参数 "body_required": [] }, // 校验列表 "list": [{ // 参数key名 "name": "uid", // 参数中文名 "title": "用户ID", // 数据类型 "type": "number", // 数字类型时设置 "number": { // 最小数值 "min": 1 }, // 分隔参数,允许传多个值,为空则限制1个值 "splitter": "|" }, { "name": "name", "title": "姓名", "type": "string", // 字符串类型时设置 "string": { // 格式 "format": "ch", // 传值范围,字符串时为限制字符长度 "range": [2, 6] }, "splitter": "|" }, { "name": "age", "title": "年龄", "type": "number", "number": { // 传值范围,数字时为最小值和最大值 "range": [1, 150] } }, { "name": "headImg", "title": "头像", "type": "string", "string": { // 拓展名,用于传媒体(图片、音频、视频)时 "extension": "png|gif|jpg|jpeg|bmp" } }, { "name": "birthday", "title": "生日", "type": "string", "string": { "format": "dateISO" } }, { "name": "username", "title": "用户名", "type": "string", "string": { "format": "username" } }, { "name": "password", "title": "密码", "type": "string", "string": { "format": "password", "different": "username" } }, { "name": "phone", "title": "手机", "type": "string", "string": { "format": "phone" } }, { "name": "email", "title": "邮箱", "type": "string", "string": { "format": "email" } }, { "name": "pay_password", "title": "支付密码", "type": "string", "string": { "format": "num", "different": "password" } }, { "name": "confirm_password", "title": "确认密码", "type": "string", "string": { "format": "password", "identical": "password" } } ] }