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

namespace app\web\validate;


use app\common\validate\BaseValidate;

class AgentUser extends BaseValidate
{
    protected $rule = [
        'id|唯一标识'=>'require|number|min:1',
        'org_code' => 'require|number|length:8',
        'agent_account' => 'require|alphaDash|length:6,20',
        'password' => 'require|alphaDash|length:6,20|confirm:password2',
        'agent_phone' => 'require|phone',
        'agent_address|代理地址' => 'chsDash|length:0:80',
        'agent_cname|代理姓名' => 'require|chs|length:2,12',
        'agent_ename|代理英文名' => 'require|chs|length:2,12',
        'bank_card_num|银行卡号' => 'require|number|length:16,19',
        'bank|开户行' => 'require|chsDash|length:4,20',
        'bank_address' => 'require',
        'id_number' => 'require|number|length:18',
    ];
    protected $message = [

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

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

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

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

    ];
    protected $scene = [
        'add' => [
            'org_code','agent_account','password'=>'require|alphaDash|length:6,20|confirm:password2','agent_phone','agent_address','agent_cname','agent_ename','bank_card_num',
            'bank','bank_address','id_number'
        ],
        'update' => [
            'id','org_code','agent_account','password'=>'alphaDash|length:6,20|confirm:password2','agent_phone','agent_address','agent_cname','agent_ename','bank_card_num',
            'bank','bank_address','id_number'
        ]
    ];
}