diff --git a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java index 1d4a582..6254ac7 100644 --- a/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java +++ b/ruoyi-api/ruoyi-api-system/src/main/java/com/ruoyi/system/api/factory/RemoteUserFallbackFactory.java @@ -27,7 +27,7 @@ public class RemoteUserFallbackFactory implements FallbackFactory getUserInfo(String username) { - return null; + return R.fail("获取用户失败:" + throwable.getMessage()); } }; } diff --git a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java index 611bee4..6c7ad50 100644 --- a/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java +++ b/ruoyi-auth/src/main/java/com/ruoyi/auth/service/SysLoginService.java @@ -55,6 +55,12 @@ public class SysLoginService } // 查询用户信息 R userResult = remoteUserService.getUserInfo(username); + + if (R.FAIL == userResult.getCode()) + { + throw new BaseException(userResult.getMsg()); + } + if (StringUtils.isNull(userResult) || StringUtils.isNull(userResult.getData())) { remoteLogService.saveLogininfor(username, Constants.LOGIN_FAIL, "登录用户不存在"); diff --git a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java index 7e569d6..1a3070c 100644 --- a/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java +++ b/ruoyi-common/ruoyi-common-security/src/main/java/com/ruoyi/common/security/handler/GlobalExceptionHandler.java @@ -29,7 +29,7 @@ public class GlobalExceptionHandler @ExceptionHandler(BaseException.class) public AjaxResult baseException(BaseException e) { - return AjaxResult.error(e.getMessage()); + return AjaxResult.error(e.getDefaultMessage()); } /**