diff --git a/app/Service/RequestService.php b/app/Service/RequestService.php index c455a87..890b39b 100644 --- a/app/Service/RequestService.php +++ b/app/Service/RequestService.php @@ -4,14 +4,19 @@ declare(strict_types=1); namespace App\Service; +use App\Exception\BusinessException; use App\Helper\StringHelper; use App\Model\RequestLog; class RequestService extends AbstractService { - public function getRequestLogByToken($token): ?RequestLog + public function getRequestLogByToken($token): RequestLog { - return RequestLog::where('request_token', $token)->first(); + $requestLog = RequestLog::where('request_token', $token)->first(); + if (is_null($requestLog)) { + throw new BusinessException('token不存在'); + } + return $requestLog; } public function createRequestLog($requestUri, $params): RequestLog