123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace app\admin\validate\sys_manage;
- use support\Validate;
- class TaskValidate extends Validate
- {
- protected $rule = [
- 'task_id' => 'require|integer',
- 'join_task_apply_user_id|申请用户' => 'require|regex:/^[0-9a-zA-Z]+$/',
- 'join_task_assign_user_id|处理用户' => 'regex:/^[0-9a-zA-Z]+$/',
- 'task_status|工单状态' => 'require|in:INIT,PENDING,RESERVING,PROCESSING,DONE,CONFIRM',
- 'task_classify|归类' => 'in:订单工单,工作工单,服务工单,维保工单',
- 'task_category|分类' => 'in:安装,维修,其他',
- 'join_task_order_id|订单' => 'regex:/^[0-9a-zA-Z]+$/',
- 'join_task_order_json|订单信息' => 'isJson',
- 'join_task_appointment_id|预约ID' => 'regex:/^[0-9a-zA-Z]+$/',
- 'join_task_appointment_json|预约信息' => 'isJson',
- 'task_assign_datetimes|分配时间' => 'date',
- 'task_accept_datetimes|受理时间' => 'date',
- 'task_reserv_datetimes|预约时间' => 'date',
- 'task_name|名称' => 'require|max:64',
- 'task_config_json|配置信息' => 'isJson',
- 'task_notify_json|回调信息' => 'isJson',
- 'task_extend_json' => 'isJson',
- 'task_process_status' => 'in:NONE,START,PAUSE,COMPLETE'
- ];
- protected $scene = [
- 'update' => ['task_id', 'join_task_apply_user_id', 'join_task_assign_user_id', 'task_status', 'task_classify', 'task_category', 'join_task_order_id'
- , 'join_task_order_json', 'join_task_appointment_id', 'join_task_appointment_json', 'task_assign_datetimes', 'task_accept_datetimes',
- 'task_reserv_datetimes', 'task_name', 'task_config_json', 'task_notify_json', 'task_extend_json'],
- 'info' => ['task_id'],
- 'process' => ['task_id', 'task_status', 'task_process_status']
- ];
- /**
- * @Desc 验证json
- * @Author Gorden
- * @Date 2024/4/7 14:06
- *
- * @param $value
- * @return bool
- */
- public function isJson($value)
- {
- if (is_json($value)) {
- return true;
- }
- return false;
- }
- }
|