first(); if (is_null($requestLog)) { throw new BusinessException('token不存在'); } return $requestLog; } public function createRequestLog($requestUri, $params): RequestLog { $requestLog = new RequestLog(); $requestLog->app_id = $params['app_id'] ?? 0; $requestLog->request_id = StringHelper::generateOrderNo(StringHelper::ORDER_NO_TYPE_REQUEST_ID); $requestLog->request_token = $requestLog->generateToken(); $requestLog->request_uri = $requestUri; $requestLog->request_data = $params; $requestLog->request_time = date('Y-m-d H:i:s'); $requestLog->save(); return $requestLog; } }