120 lines
2.6 KiB
PHP
120 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace app\admin\validate\user;
|
|
|
|
|
|
use app\common\validate\BaseValidate;
|
|
|
|
|
|
/**
|
|
* 用户列表验证器
|
|
* Class UserValidate
|
|
* @package app\admin\validate\user
|
|
*/
|
|
class UserValidate extends BaseValidate
|
|
{
|
|
|
|
/**
|
|
* 设置校验规则
|
|
* @var string[]
|
|
*/
|
|
protected $rule = [
|
|
'id' => 'require',
|
|
'real_name' => 'require',
|
|
'nickname' => 'require',
|
|
'account' => 'require',
|
|
'password' => 'require',
|
|
'mobile' => 'require|unique:user',
|
|
'is_disable' => 'in:0,1',
|
|
'sex' => 'in:1,2',
|
|
'province' => 'require',
|
|
'city' => 'require',
|
|
'area' => 'require',
|
|
'street' => 'require',
|
|
'village' => 'require',
|
|
'brigade' => 'require',
|
|
'user_ship' => 'require',
|
|
'type' => 'require|number',
|
|
];
|
|
|
|
|
|
/**
|
|
* 参数描述
|
|
* @var string[]
|
|
*/
|
|
protected $field = [
|
|
'id' => 'id',
|
|
'real_name' => '真实姓名',
|
|
'nickname' => '用户昵称',
|
|
'account' => '用户账号',
|
|
'password' => '用户密码',
|
|
'mobile' => '用户电话',
|
|
'is_disable' => '是否禁用',
|
|
'sex' => '用户性别',
|
|
'province' => '省',
|
|
'city' => '市',
|
|
'area' => '区',
|
|
'street' => '街道',
|
|
'village' => '村',
|
|
'brigade' => ' 队',
|
|
'user_ship' => ' 会员类型',
|
|
'type' => '查询类型',
|
|
];
|
|
|
|
public function sceneFund()
|
|
{
|
|
return $this->only(['type','id']);
|
|
|
|
}
|
|
/**
|
|
* @notes 添加场景
|
|
* @return UserValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/25 10:20
|
|
*/
|
|
public function sceneAdd()
|
|
{
|
|
return $this->remove('id',true);
|
|
}
|
|
|
|
public function scenestoreAdd()
|
|
{
|
|
return $this->only(['mobile','province','city','district','street','village','brigade','user_ship']);
|
|
}
|
|
|
|
/**
|
|
* @notes 编辑场景
|
|
* @return UserValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/25 10:20
|
|
*/
|
|
public function sceneEdit()
|
|
{
|
|
return $this->only(['id','avatar','real_name','nickname','account','password','mobile','is_disable','sex'])->remove('password','require');
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 删除场景
|
|
* @return UserValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/25 10:20
|
|
*/
|
|
public function sceneDelete()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
|
|
/**
|
|
* @notes 详情场景
|
|
* @return UserValidate
|
|
* @author likeadmin
|
|
* @date 2024/04/25 10:20
|
|
*/
|
|
public function sceneDetail()
|
|
{
|
|
return $this->only(['id']);
|
|
}
|
|
|
|
} |