From 93279a53e25f4185f64de64abd40552688d9e5f1 Mon Sep 17 00:00:00 2001 From: koogua Date: Wed, 6 Oct 2021 18:39:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84shallowUserInfo=E5=A4=84?= =?UTF-8?q?=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/Logic/UserTrait.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Services/Logic/UserTrait.php b/app/Services/Logic/UserTrait.php index 68dbf048..2f379c30 100644 --- a/app/Services/Logic/UserTrait.php +++ b/app/Services/Logic/UserTrait.php @@ -29,10 +29,14 @@ trait UserTrait public function handleShallowUserInfo($id) { + if (empty($id)) return new \stdClass(); + $userRepo = new UserRepo(); $user = $userRepo->findShallowUserById($id); + if (!$user) return new \stdClass(); + $result = $user->toArray(); $result['avatar'] = kg_cos_user_avatar_url($user->avatar);