46 lines
1.4 KiB
PHP
46 lines
1.4 KiB
PHP
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Author: ywxapp<admin@ywxapp.cn>
|
|
// +----------------------------------------------------------------------
|
|
declare (strict_types = 1);
|
|
|
|
namespace app\member\validate;
|
|
|
|
use think\Validate;
|
|
|
|
/**
|
|
* Profile 类
|
|
*
|
|
* @author ywxapp <admin@ywxapp.cn>
|
|
*/
|
|
class Profile extends Validate
|
|
{
|
|
/**
|
|
* 个人资料保存校验
|
|
* 字段:nickname 昵称 / email 邮箱 / mobile 手机号(均选填,但填写时需合规)
|
|
*/
|
|
protected $rule = [
|
|
'nickname' => 'chsDash|length:2,20',
|
|
'email' => 'email',
|
|
'mobile' => 'regex:/^1[3-9]\d{9}$/',
|
|
];
|
|
|
|
protected $message = [
|
|
'nickname.chsDash' => '昵称只能包含中文、字母、数字及 _-',
|
|
'nickname.length' => '昵称长度需在 2-20 位',
|
|
'email.email' => '邮箱格式不正确',
|
|
'mobile.regex' => '手机号格式不正确',
|
|
];
|
|
|
|
/**
|
|
* 修改密码校验
|
|
*/
|
|
protected $scene = [
|
|
'password' => ['old_password' => 'require', 'password' => 'require|length:6,20', 'password_confirm' => 'require|confirm:password'],
|
|
];
|
|
}
|