From eaafaf8a107f3e2bd5481818bbc16a007838d0d5 Mon Sep 17 00:00:00 2001 From: Anyon Date: Tue, 24 Nov 2020 18:25:47 +0800 Subject: [PATCH] Update Auth.php --- app/data/controller/api/Auth.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/data/controller/api/Auth.php b/app/data/controller/api/Auth.php index cc121e508..0d53828a1 100644 --- a/app/data/controller/api/Auth.php +++ b/app/data/controller/api/Auth.php @@ -48,13 +48,14 @@ abstract class Auth extends Controller protected function getUser() { try { + $user = UserService::instance(); if (empty($this->uuid)) { $token = input('token') ?: $this->request->header('token'); if (empty($token)) $this->error('接口认证令牌不能为空!'); - [$state, $message, $this->uuid] = UserService::instance()->checkUserToken($this->type, $token); + [$state, $message, $this->uuid] = $user->checkUserToken($this->type, $token); if (empty($state)) $this->error($message); } - return UserService::instance()->get($this->type, $this->uuid); + return $user->get($this->type, $this->uuid); } catch (HttpResponseException $exception) { throw $exception; } catch (\Exception $exception) {