zx/app/validate/admin/CrmebServeValidata.php

55 lines
1.7 KiB
PHP
Raw Permalink Normal View History

2024-07-02 15:32:59 +08:00
<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\validate\admin;
use think\Validate;
class CrmebServeValidata extends Validate
{
protected $failException = true;
/**
* 定义验证规则
* 格式:'字段名' => ['规则1','规则2'...]
*
* @var array
*/
protected $rule = [
'phone' => 'require|number|mobile',
'password' => 'require',
'verify_code' => 'require|number',
'account' => 'require',
];
/**
* 定义错误信息
* 格式:'字段名.规则名' => '错误信息'
*
* @var array
*/
protected $message = [
'phone.require' => '请填写手机号码',
'phone.number' => '您输入的手机号码必须为数字',
'phone.mobile' => '您输入的手机号码有误',
'password.require' => '密码必须填写',
'verify_code.require' => '请填写短信验证码',
'verify_code.number' => '短信验证码必须为数字',
'account.require' => '请填写账号',
];
protected $scene = [
'login' => ['password', 'account'],
'phone' => ['phone']
];
}