修复登出自己的请求方式问题;添加无权限的统一拦截
This commit is contained in:
parent
837129e912
commit
fd11fe4945
|
|
@ -69,7 +69,7 @@ public class UserController {
|
|||
* 登出自己
|
||||
* @return 登出结果
|
||||
*/
|
||||
@PostMapping("/logout")
|
||||
@PutMapping("/logout")
|
||||
public AppServeResponse logout() {
|
||||
return userService.logout();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.wcs.serve.exception.handler;
|
||||
|
||||
import cn.dev33.satoken.exception.NotLoginException;
|
||||
import cn.dev33.satoken.exception.NotPermissionException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.validation.ObjectError;
|
||||
|
|
@ -44,6 +45,18 @@ public class AppExceptionHandler {
|
|||
log.error("未登录异常:", nle);
|
||||
}
|
||||
|
||||
/**
|
||||
* 无功能权限异常
|
||||
* @param ex 异常信息
|
||||
* @return 响应结果
|
||||
*/
|
||||
@ExceptionHandler(value = NotPermissionException.class)
|
||||
@ResponseBody
|
||||
public AppServeResponse handleNotPermissionException(Exception ex) {
|
||||
log.error("无功能权限异常", ex);
|
||||
return AppServeResponseFactory.fail("无此功能权限");
|
||||
}
|
||||
|
||||
/**
|
||||
* 兜底异常
|
||||
* @param ex 异常信息
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user