zss
2024-10-18 1f15333b0a97a327865f7aab8f1e3f9ba8fc16f8
framework/src/main/java/com/yuanchu/mom/config/PowerConfig.java
@@ -30,6 +30,9 @@
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        if(handler instanceof HandlerMethod) {
            if(request.getRequestURL().toString().contains("/error") || request.getRequestURL().toString().contains("/outPath")){
                return HandlerInterceptor.super.preHandle(request, response, handler);
            }
            HandlerMethod h = (HandlerMethod)handler;
            ValueAuth annotation = h.getMethodAnnotation(ValueAuth.class);
            if(annotation!=null){
@@ -38,7 +41,6 @@
            JSONObject obj = JSONUtil.parseObj(new Jwt().readJWT(request.getHeader("token")).get("data"));
            Integer userId = Integer.parseInt(obj.get("id") + "");
            int i = authMapper.isPower(userId, h.getMethod().getName());
            if (i == 0){
                throw new ErrorException(obj.get("name") + " 无权限访问 " + h.getMethod().getName() + " 接口");
            }
@@ -54,5 +56,6 @@
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        HandlerInterceptor.super.afterCompletion(request, response, handler, ex);
    }
}