84 lines
3.0 KiB
PHP
84 lines
3.0 KiB
PHP
<?php
|
|
/**
|
|
* Author: ykxiao
|
|
* Date: 2025/6/3
|
|
* Time: 下午8:25
|
|
* Description: 用户验证类。
|
|
*
|
|
* (c) ykxiao <yk_9001@hotmail.com>
|
|
*
|
|
* This source file is subject to the MIT license that is bundled
|
|
* with this source code in the file LICENSE.
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Request;
|
|
|
|
class PurchaseRequest extends AbstractRequest
|
|
{
|
|
public array $scenes = [
|
|
'userLogin' => ['login_name', 'password'],
|
|
'addUser' => [
|
|
'login_name', // 登录用户名
|
|
'password' => 'string|between:6,15', // 密码
|
|
'dept_id', // 部门ID
|
|
'department', // 部门名称
|
|
'emp_id', // 员工工号
|
|
'name', // 姓名
|
|
'mobile', // 手机号
|
|
'email', // 邮箱地址
|
|
'avatar', // 头像
|
|
'active_status', // 状态 0禁用 1启用
|
|
'remark', // 备注
|
|
'role_ids', // 角色ID列表
|
|
'role_ids.*' // 角色ID
|
|
],
|
|
'getUserList' => [
|
|
'page', // 页码
|
|
'pageSize', // 页大小
|
|
]
|
|
];
|
|
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'login_name' => 'required|string|regex:/^[a-zA-Z0-9_]+$/|between:3,20',
|
|
'password' => 'required|string|between:6,15',
|
|
'dept_id' => 'integer|min:1',
|
|
'department' => 'string|between:2,20',
|
|
'emp_id' => 'integer|min:1',
|
|
'name' => 'string|between:2,20',
|
|
'mobile' => 'string|between:11,11',
|
|
'email' => 'string|between:6,30',
|
|
'avatar' => 'string|between:1,255',
|
|
'active_status' => 'in:0,1',
|
|
'remark' => 'string|between:1,255',
|
|
'role_ids' => 'array',
|
|
'role_ids.*' => 'integer|min:1|distinct',
|
|
'page' => 'integer|min:1',
|
|
'pageSize' => 'integer|min:1',
|
|
];
|
|
}
|
|
|
|
public function attributes(): array
|
|
{
|
|
return [
|
|
'login_name' => '登录账号',
|
|
'password' => '登录密码',
|
|
'dept_id' => '部门ID',
|
|
'department' => '部门名称',
|
|
'emp_id' => '员工工号',
|
|
'name' => '姓名',
|
|
'mobile' => '手机号',
|
|
'email' => '邮箱地址',
|
|
'avatar' => '头像',
|
|
'active_status' => '状态',
|
|
'remark' => '备注',
|
|
'role_ids' => '角色ID列表',
|
|
'role_ids.*' => '角色ID',
|
|
'page' => '页码',
|
|
'pageSize' => '页大小',
|
|
];
|
|
}
|
|
} |