From 1ff08a77ff24ef9a313fb508a79c75c308370f43 Mon Sep 17 00:00:00 2001 From: wong <106998207@qq.com> Date: Fri, 25 Jul 2025 16:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/controller/PasswordLoginController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Server/application/common/controller/PasswordLoginController.php b/Server/application/common/controller/PasswordLoginController.php index 74058fe4..6f3d62cd 100644 --- a/Server/application/common/controller/PasswordLoginController.php +++ b/Server/application/common/controller/PasswordLoginController.php @@ -21,7 +21,7 @@ class PasswordLoginController extends BaseController * @param int $typeId * @return UserModel */ - protected function getUserProfileWithAccountAndType(string $account, int $typeId): UserModel + protected function getUserProfileWithAccountAndType(string $account, int $typeId) { $user = UserModel::where( function ($query) use ($account) { @@ -34,7 +34,11 @@ class PasswordLoginController extends BaseController } )->find(); - return $user; + if(!empty($user)){ + return $user; + }else{ + return ''; + } } /** @@ -48,7 +52,6 @@ class PasswordLoginController extends BaseController protected function getUser(string $account, string $password, int $typeId): array { $user = $this->getUserProfileWithAccountAndType($account, $typeId); - if (!$user) { throw new \Exception('用户不存在或已禁用', 403); }