|
|
@@ -0,0 +1,69 @@
|
|
|
+<?php
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+// | Author: 小夏 < 449134904@qq.com>
|
|
|
+// +----------------------------------------------------------------------
|
|
|
+namespace app\index\validate;
|
|
|
+
|
|
|
+use think\Validate;
|
|
|
+
|
|
|
+class UsersValidate extends Validate
|
|
|
+{
|
|
|
+ protected $rule = [
|
|
|
+ 'mobile' => 'require|mobile|length:11,20',
|
|
|
+ 'code' => 'require|alphaNum|length:4,8',
|
|
|
+ 'password' => 'require|pwd|length:4,20',
|
|
|
+ 'realname' => 'require|chs',
|
|
|
+ 'nickname' => 'require',
|
|
|
+ 'account' => 'require|alphaNum|length:2,30',
|
|
|
+ ];
|
|
|
+ protected $message = [
|
|
|
+ 'mobile.require' => '手机号码不为空',
|
|
|
+ 'mobile.mobile' => '手机号码格式不正确',
|
|
|
+ 'mobile.length' => '手机号码格式不正确',
|
|
|
+ 'code.require' => '手机验证码不为空',
|
|
|
+ 'code.alphaNum' => '手机验证码格式不正确',
|
|
|
+ 'code.length' => '手机验证码格式不正确',
|
|
|
+ 'password.require' => '登录密码不为空',
|
|
|
+ 'password.pwd' => '登录密码格式不正确',
|
|
|
+ 'password.length' => '登录密码格式不正确',
|
|
|
+ 'now_address.require' => '请选择现居地址',
|
|
|
+ 'now_address.*' => '现居地址格式不正确',
|
|
|
+ 'home_address.require' => '请选择家乡地址',
|
|
|
+ 'realname.require' => '真实姓名不为空',
|
|
|
+ 'realname.chs' => '真实姓名格式不正确',
|
|
|
+ 'nickname.require' => '请填写昵称',
|
|
|
+ 'nickname.chs' => '昵称格式不正确',
|
|
|
+ 'height.require' => '请填写身高信息',
|
|
|
+ 'height.length' => '身高格式不正确',
|
|
|
+ 'weight.require' => '请填写体重信息',
|
|
|
+ 'weight.length' => '身高格式不正确',
|
|
|
+ 'weight.integer' => '体重格式错误',
|
|
|
+ 'sex.require' => '请选择性别',
|
|
|
+ 'brithday.require' => '请选择出生日期',
|
|
|
+ 'married.require' => '请选择婚姻状况',
|
|
|
+ 'wechat_code.require' => '请填写微信号',
|
|
|
+ 'idcard.require' => '请填写身份证号码',
|
|
|
+ 'idcard.idcard' => '请填写正确格式的身份证号码',
|
|
|
+ 'graduate.require' => '请填写毕业学校名称',
|
|
|
+ 'eduacation.require' => '请选择您的学历',
|
|
|
+ 'company.require' => '请填写就职公司名称',
|
|
|
+ 'occupation.require' => '请选择职业',
|
|
|
+ ];
|
|
|
+
|
|
|
+ protected $regex = [
|
|
|
+ 'mobile'=> '/^((13[0-9])|(14[5,7])|(15[0-9])|(16[6-8])|(17[0,1,3,5-8])|(18[0-9])|(19[1-9]))\\d{8}$/',
|
|
|
+ 'pwd'=> '/^[0-9a-zA-Z][0-9a-zA-Z\_\!\@\#\$\%\^\&\*\(\)]{2,19}/',
|
|
|
+ 'idcard'=> '/^[1-9]\d{5}(18|19|20|(3\d))\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/',
|
|
|
+ ];
|
|
|
+
|
|
|
+ protected $scene = [
|
|
|
+ 'reg' => ['nickname','mobile','password'],
|
|
|
+ 'login' => ['mobile','password'],
|
|
|
+ ];
|
|
|
+}
|