From 4d458814767268bb19ee1ae44761a2e1fdf5d934 Mon Sep 17 00:00:00 2001 From: liutong <836164388@qq.com> Date: Fri, 30 May 2025 16:44:37 +0800 Subject: [PATCH] =?UTF-8?q?fix(login):=20=E4=BC=98=E5=8C=96=E8=B4=A6?= =?UTF-8?q?=E5=8F=B7=E4=B8=8D=E5=AD=98=E5=9C=A8=E6=97=B6=E7=9A=84=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在查询员工信息后,增加对查询结果为空的检查 - 如果账号不存在,抛出 '账号不存在' 的异常 - 提升用户体验,明确提示错误原因 --- niucloud/app/service/api/login/LoginService.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/niucloud/app/service/api/login/LoginService.php b/niucloud/app/service/api/login/LoginService.php index cff79559..3ce056fa 100644 --- a/niucloud/app/service/api/login/LoginService.php +++ b/niucloud/app/service/api/login/LoginService.php @@ -354,6 +354,9 @@ class LoginService extends BaseApiService { //查询员工信息 $member_info = (new Personnel())->where('phone', $params['phone'])->find(); + if(!$member_info){ + throw new ApiException('账号不存在'); + } if ($member_info->status != 2) throw new ApiException('账号状态异常禁止登录'); $user = (new SysUser())->where('username', $params['phone'])->find();