修复登录报错问题

This commit is contained in:
wong
2025-07-25 16:25:00 +08:00
parent b3a1137d8e
commit 1ff08a77ff

View File

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