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->historyOrders( (string) $params['start_time'], (string) $params['end_time'], (int) ($params['page'] ?? 1), (int) ($params['limit'] ?? 200) ); 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()); } } }