Browse Source

fix(login): 优化账号不存在时的错误处理

- 在查询员工信息后,增加对查询结果为空的检查
- 如果账号不存在,抛出 '账号不存在' 的异常
- 提升用户体验,明确提示错误原因
master
liutong 10 months ago
parent
commit
4d45881476
  1. 3
      niucloud/app/service/api/login/LoginService.php

3
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();

Loading…
Cancel
Save