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); }