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:
parent
1c0af6fa1e
commit
0c9256751d
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user