1
0
mirror of https://gitee.com/koogua/course-tencent-cloud.git synced 2025-06-23 03:50:56 +08:00

优化AuthTrait

This commit is contained in:
xiaochong0302 2023-07-11 09:55:21 +08:00
parent 1c0af6fa1e
commit 0c9256751d

View File

@ -30,7 +30,7 @@ trait Auth
return $this->getGuestUser();
}
if ($cache == false) {
if (!$cache) {
$userRepo = new UserRepo();
$user = $userRepo->findById($authUser['id']);
} else {
@ -54,7 +54,7 @@ trait Auth
$validator->checkAuthUser($authUser['id']);
if ($cache == false) {
if (!$cache) {
$userRepo = new UserRepo();
$user = $userRepo->findById($authUser['id']);
} else {
@ -74,6 +74,7 @@ trait Auth
$user->id = 0;
$user->name = 'guest';
$user->avatar = kg_cos_user_avatar_url(null);
return $user;
}