| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 | <?phpnamespace app\admin\validate\sys_manage;use think\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' => '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;    }}
 |