puzhibing
2023-08-31 ef04ce57881e6a338b10d596c5eb76b2220598bf
user/guns-admin/src/main/java/com/supersavedriving/user/core/intercept/RestApiInteceptor.java
@@ -5,6 +5,8 @@
import com.supersavedriving.user.core.common.exception.BizExceptionEnum;
import com.supersavedriving.user.core.util.JwtTokenUtil;
import com.supersavedriving.user.core.util.RenderUtil;
import com.supersavedriving.user.modular.system.util.ResultUtil;
import com.supersavedriving.user.modular.system.warpper.ResponseWarpper;
import io.jsonwebtoken.JwtException;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
@@ -48,12 +50,14 @@
                }
            } catch (JwtException e) {
                //有异常就是token解析失败
                RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage()));
//                RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage()));
                RenderUtil.renderJson(response, ResponseWarpper.success(ResultUtil.tokenErr()));
                return false;
            }
        } else {
            //header没有带Bearer字段
            RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage()));
//            RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage()));
            RenderUtil.renderJson(response, ResponseWarpper.success(ResultUtil.tokenErr()));
            return false;
        }
        return true;