validate([ 'page' => ['nullable', 'integer', 'min:1'], 'limit' => ['nullable', 'integer', 'min:1', 'max:200'], 'user_id' => ['nullable', 'integer', 'min:1'], 'member_id' => ['nullable', 'string', 'max:64'], 'username' => ['nullable', 'string', 'max:128'], 'first_name' => ['nullable', 'string', 'max:128'], 'player_id' => ['nullable', 'string', 'max:32'], 'platform' => ['nullable', 'string', 'max:32'], 'game_order_id' => ['nullable', 'string', 'max:128'], 'game_type' => ['nullable', 'integer', 'in:1,2,3,4,5,6,7'], 'status' => ['nullable', 'integer', 'in:0,1,2,3'], 'start_time' => ['nullable', 'date_format:Y-m-d H:i:s', 'required_with:end_time'], 'end_time' => [ 'nullable', 'date_format:Y-m-d H:i:s', 'required_with:start_time', 'after_or_equal:start_time', ], ]); return $this->success($service->paginate($params)); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage()); } } public function sync(ThirdGameOrderService $service): JsonResponse { try { $params = request()->validate([ 'start_time' => ['required', 'date_format:Y-m-d H:i:s'], 'end_time' => ['required', 'date_format:Y-m-d H:i:s', 'after_or_equal:start_time'], 'page' => ['nullable', 'integer', 'min:1'], 'limit' => ['nullable', 'integer', 'min:1', 'max:2000'], ]); $result = $service->sync( (string) $params['start_time'], (string) $params['end_time'], (int) ($params['page'] ?? 1), (int) ($params['limit'] ?? 2000) ); if (!$result['ok']) { throw new Exception($result['msg'], HttpStatus::CUSTOM_ERROR); } unset($result['ok']); return $this->success($result); } catch (ValidationException $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->validator->errors()->first()); } catch (Exception $e) { return $this->error(HttpStatus::CUSTOM_ERROR, $e->getMessage()); } } }