Files
MrleeAdmin/backend/plugin/produce/app/validate/ExceptionRecordValidate.php
T

67 lines
3.3 KiB
PHP
Raw Normal View History

2026-08-31 13:16:46 +08:00
<?php
declare(strict_types=1);
namespace plugin\produce\app\validate;
use core\base\BaseValidate;
class ExceptionRecordValidate extends BaseValidate
{
public function rules(): array
{
return [
'order_no' => ['required', 'max:100'],
'user_code' => ['nullable', 'max:50'],
'reporter' => ['nullable', 'max:100'],
'type_id' => ['nullable', 'integer'],
'type_code' => ['required', 'max:64'],
'type_name' => ['required', 'max:100'],
'reason_id' => ['nullable', 'integer'],
'reason_code' => ['required', 'max:64'],
'reason_name' => ['required', 'max:100'],
'issue_id' => ['nullable', 'integer'],
'issue_code' => ['nullable', 'max:64'],
'issue_name' => ['nullable', 'max:100'],
'images' => ['nullable'],
'remark' => ['nullable', 'max:65535'],
'status' => ['nullable', 'integer', 'in:0,1,2'],
'handler' => ['nullable', 'max:100'],
'handler_id' => ['nullable', 'integer'],
'handled_at' => ['nullable', 'integer'],
'reported_at' => ['nullable', 'integer'],
];
}
protected array $message = [
'order_no.required' => '单号或条码不能为空',
'order_no.max' => '单号或条码不能超过100个字符',
'user_code.max' => '提报人工号不能超过50个字符',
'reporter.max' => '提报人不能超过100个字符',
'type_id.integer' => '处理类型格式不正确',
'type_code.required' => '处理类型编码不能为空',
'type_code.max' => '处理类型编码不能超过64个字符',
'type_name.required' => '处理类型名称不能为空',
'type_name.max' => '处理类型名称不能超过100个字符',
'reason_id.integer' => '异常原因格式不正确',
'reason_code.required' => '异常原因编码不能为空',
'reason_code.max' => '异常原因编码不能超过64个字符',
'reason_name.required' => '异常原因名称不能为空',
'reason_name.max' => '异常原因名称不能超过100个字符',
'issue_id.integer' => '具体问题格式不正确',
'issue_code.max' => '具体问题编码不能超过64个字符',
'issue_name.max' => '具体问题名称不能超过100个字符',
'status.integer' => '处理状态格式不正确',
'status.in' => '处理状态值不正确',
'handler.max' => '处理人不能超过100个字符',
'handler_id.integer' => '处理人ID格式不正确',
'handled_at.integer' => '处理时间格式不正确',
'reported_at.integer' => '提报时间格式不正确',
];
protected array $scene = [
'store' => ['order_no', 'user_code', 'reporter', 'type_id', 'type_code', 'type_name', 'reason_id', 'reason_code', 'reason_name', 'issue_id', 'issue_code', 'issue_name', 'images', 'remark', 'status', 'handler', 'handler_id', 'handled_at', 'reported_at'],
'update' => ['order_no', 'user_code', 'reporter', 'type_id', 'type_code', 'type_name', 'reason_id', 'reason_code', 'reason_name', 'issue_id', 'issue_code', 'issue_name', 'images', 'remark', 'status', 'handler', 'handler_id', 'handled_at', 'reported_at'],
];
}