60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
<?php
|
|
/*
|
|
* @Author: YwxApp <ywx@ywxapp.cn>
|
|
* @Date: 2026-04-29 02:32:33
|
|
* @LastEditors: YwxApp <ywx@ywxapp.cn>
|
|
* @LastEditTime: 2026-07-21 23:27:10
|
|
* @Description:
|
|
* @FilePath: \ywxapp_dev\app\backend\validate\Admin.php
|
|
* @CustomString: Copyright (c) 2026 YwxApp
|
|
*/
|
|
|
|
declare (strict_types = 1);
|
|
namespace app\backend\validate;
|
|
|
|
use think\Validate;
|
|
|
|
/**
|
|
* Admin 类
|
|
*
|
|
* @author ywxapp <admin@ywxapp.cn>
|
|
*/
|
|
class Admin extends Validate
|
|
{
|
|
protected $rule = [
|
|
'account' => 'require|min:5|max:20',
|
|
'nickname' => 'require|min:2|max:20',
|
|
'password' => 'require|min:6|max:20',
|
|
'confirmpass' => 'require|confirm:password',
|
|
'email' => 'require|email',
|
|
'mobile' => 'require|mobile',
|
|
//'status' => 'require|in:0,1',
|
|
];
|
|
|
|
protected $message = [
|
|
'account.require' => '用户名不能为空',
|
|
'account.min' => '用户名长度不能少于3个字符',
|
|
'account.max' => '用户名长度不能超过20个字符',
|
|
'nickname.require' => '昵称不能为空',
|
|
'nickname.min' => '昵称长度不能少于2个字符',
|
|
'nickname.max' => '昵称长度不能超过20个字符',
|
|
'password.require' => '密码不能为空',
|
|
'password.min' => '密码长度不能少于6个字符',
|
|
'password.max' => '密码长度不能超过20个字符',
|
|
'confirmpass.require' => '确认密码不能为空',
|
|
'confirmpass.confirm' => '两次输入的密码不一致',
|
|
'email.require' => '邮箱不能为空',
|
|
'email.email' => '邮箱格式不正确',
|
|
'mobile.require' => '电话不能为空',
|
|
'mobile.mobile' => '电话格式不正确',
|
|
//'status.require' => '状态不能为空',
|
|
//'status.in' => '状态值不正确',
|
|
];
|
|
|
|
// 更新场景
|
|
|
|
public function sceneUpdate()
|
|
{
|
|
return $this->remove('password', 'require');
|
|
}
|
|
} |