From 99542dbc2996ff52aed1146aecdfe146655dd8c9 Mon Sep 17 00:00:00 2001 From: elf <360197197@qq.com> Date: Mon, 7 Aug 2023 23:04:46 +0800 Subject: [PATCH] yh --- app/Service/RequestService.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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