data_center/app/common/validate/login/RegisterValidate.php

63 lines
2.3 KiB
PHP

<?php
namespace app\common\validate\login;
use app\common\validate\BaseValidate;
/**
* 注册验证器
* Class RegisterValidate
* @package app\api\validate
*/
class RegisterValidate extends BaseValidate
{
protected $regex = [
'register' => '^(?=.*[A-Za-z])(?=.*\d)[A-Za-z\d]+$',
'password' => '/^(?![0-9]+$)(?![a-z]+$)(?![A-Z]+$)(?!([^(0-9a-zA-Z)]|[\(\)])+$)([^(0-9a-zA-Z)]|[\(\)]|[a-z]|[A-Z]|[0-9]){6,20}$/'
];
protected $rule = [
'phone' => 'require|mobile|unique:user,user_phone',
'password' => 'require|length:6,20',
'password_confirm' => 'require|confirm',
'age' => 'require|number|gt:0',
'gender' => 'require|in:0,1,2',
'province' => 'require|number',
'city' => 'require|number',
'area' => 'require|number',
'street' => 'require|number',
'village' => 'require|number',
'brigade' => 'require|number',
'address' => 'require'
];
protected $message = [
'phone.require' => '请输入手机号码',
'phone.mobile' => '请输入正确的手机号码',
'phone.unique' => '该手机号码已注册',
'password.require' => '请输入密码',
'password.length' => '密码须在6-25位之间',
'password_confirm.require' => '请输入确认密码',
'password_confirm.confirm' => '两次输入的密码不一致',
'age.require' => '请输入用户年龄',
'age.number' => '年龄必须是数字',
'age.gt' => '年龄必须大于0',
'gender.require' => '请输入用户性别',
'gender.in' => '用户性别值错误',
'province.require' => '请输入所在省份编码',
'province.number' => '省份编码值错误',
'city.require' => '请输入所在城市编码',
'city.number' => '城市编码值错误',
'area.require' => '请输入所在区县编码',
'area.number' => '区县编码值错误',
'street.require' => '请输入所在镇街编码',
'street.number' => '镇街编码值错误',
'village.require' => '请输入所在村社编码',
'village.number' => '村社编码值错误',
'brigade.require' => '请输入所在小组编码',
'brigade.number' => '小组编码值错误',
'address.require' => '请输入详细地址'
];
}