<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/29
 * Time: 15:50
 */

namespace app\web\validate;


use app\common\validate\BaseValidate;

class User extends BaseValidate
{
    protected $rule = [
        'uid'=>'require|number|min:1',
        'org_code' => 'require|number|length:8',
        'login_account' => 'require|alphaDash|length:6,20',
        'password' => 'require|alphaDash|length:6,20|confirm:password2',
        'user_phone' => 'require|phone',//等待自定义规则
        'user_address' => 'chsDash|length:0:80',
        'user_cname' => 'require|chs|length:2:12',
        'invalid_flag' => 'number|min:1',
        'user_sex' => 'require|number|in:"0,1"',
        'bank_card_num|银行卡号' => 'require|number|length:16:19',
        'bank|开户行' => 'require|chsDash|length:4:20',
        'bank_address' => '',
        'id_number' => '',
    ];
    protected $message = [

        'org_code' => '请选择所属机构',

        'login_account' => '账号必须为长度6-20的字母数字下划线_及破折号-',

        'password.require' => '密码不能为空',
        'password.alphaDash' => '密码只能为字母数字下划线_及破折号-',
        'password.length' => '密码长度必须为6-20',
        'password.confirm' => '两次密码必须相同',

        'user_phone.require' => '手机号必填',
        'user_phone.number' => '手机号必须是数字',
        'user_phone.length' => '手机号长度为11',

    ];
    protected $scene = [
        'add' => [
            'org_code','login_account','password','user_phone','user_address','user_cname'
        ],
        'update' => [
            'id','org_code','login_account','password','user_phone','user_address','user_cname'
        ]
    ];
}