UserValidate.php
2.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?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 api\portal\validate;
use think\Validate;
class UserValidate extends Validate
{
protected $rule = [
'name' => ['require','length:2,4','chs'],
'password' => ['require','length:6,16'],
'tel' => ['regex'=>'/^1(3|4|5|7|8)\d{9}$/','require'],
'sure_password' => 'require',
'city' => 'require',
'company' => 'require',
'store' => 'require',
'quarters' => 'require',
];
protected $message = [
'name.require' => '姓名不能为空!',
'name.length' => '姓名为2-4个汉字!',
'name.chs' => '姓名只能是汉字!',
'tel.require' => '手机号不能为空!',
'tel.regex' => '手机号格式不正确!',
'password.require' => '密码不能为空!',
'password.length' => '密码长度为6-16位!',
'sure_password.require' => '确认密码不能为空!',
'city.require' => '城市不能为空!',
'company.require' => '所属公司不能为空!',
'store.require' => '门店不能为空!',
'quarters.require' => '服务小区不能为空!',
];
protected $scene = [
// 'add' => ['name','tel','password','sure_password'],
// 'edit' => ['tel','password','name','sure_password'],
'user' => ['tel','password','name','sure_password'],
'intermediary' => ['tel','password','name','sure_password','city','company','store','quarters'],
];
}