Commit a2423d57 by guojuxing

登录拦截response status改动

parent 76ef9144
...@@ -88,6 +88,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter { ...@@ -88,6 +88,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
return true; return true;
} }
if (userDetail == null || userDetail.getUserInfo() == null) { if (userDetail == null || userDetail.getUserInfo() == null) {
response.setStatus(6666);
response.sendError(6666, "登录信息不存在,请登录");
throw new CommonException(ErrorCode.LOGIN_INVALID.getErrorCode(), "登录信息不存在,请登录"); throw new CommonException(ErrorCode.LOGIN_INVALID.getErrorCode(), "登录信息不存在,请登录");
} }
request.setAttribute("user", userDetail); request.setAttribute("user", userDetail);
...@@ -109,6 +111,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter { ...@@ -109,6 +111,8 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
//判断是否有权限 //判断是否有权限
Map<String, Object> menuUrlMap = userDetail.getMenuUrlMap(); Map<String, Object> menuUrlMap = userDetail.getMenuUrlMap();
if (menuUrlMap == null || menuUrlMap.isEmpty()) { if (menuUrlMap == null || menuUrlMap.isEmpty()) {
response.setStatus(0003);
response.sendError(0003, "sorry,您无该页面的访问权限,请联系超级管理员!");
throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!"); throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!");
} }
...@@ -116,12 +120,16 @@ public class AuthInterceptor extends HandlerInterceptorAdapter { ...@@ -116,12 +120,16 @@ public class AuthInterceptor extends HandlerInterceptorAdapter {
//说明是操作项 //说明是操作项
//如果匹配上了,说明是没权限 //如果匹配上了,说明是没权限
if (menuUrlMap.containsKey(uri)) { if (menuUrlMap.containsKey(uri)) {
response.setStatus(0003);
response.sendError(0003, "sorry,您无该页面的访问权限,请联系超级管理员!");
throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!"); throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!");
} }
} else { } else {
//说明是页面 //说明是页面
//如果没有匹配上,说明没权限 //如果没有匹配上,说明没权限
if (!menuUrlMap.containsKey(uri)) { if (!menuUrlMap.containsKey(uri)) {
response.setStatus(0003);
response.sendError(0003, "sorry,您无该页面的访问权限,请联系超级管理员!");
throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!"); throw new CommonException(ErrorCode.SYSTEM_ERROR.getErrorCode(), "sorry,您无该页面的访问权限,请联系超级管理员!");
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment