修复小程序端免登录无法获取id的问题

This commit is contained in:
TinyAnts 2022-09-08 17:57:36 +08:00
parent 394793710d
commit ff167a56b3
1 changed files with 1 additions and 2 deletions

View File

@ -47,6 +47,7 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
// 免登录接口
String token = request.getHeader("token");
token = FrontConfig.frontendTokenKey + token;
List<String> notLoginUri = Arrays.asList(FrontConfig.notLoginUri);
if (notLoginUri.contains(request.getRequestURI())) {
if (StringUtil.isNotEmpty(token)) {
@ -60,7 +61,6 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
}
// Token是否为空
if (StringUtils.isBlank(token)) {
AjaxResult result = AjaxResult.failed(HttpEnum.TOKEN_EMPTY.getCode(), HttpEnum.TOKEN_EMPTY.getMsg());
response.getWriter().print(JSON.toJSONString(result));
@ -68,7 +68,6 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
}
// Token是否过期
token = FrontConfig.frontendTokenKey + token;
if (!RedisUtil.exists(token)) {
AjaxResult result = AjaxResult.failed(HttpEnum.TOKEN_INVALID.getCode(), HttpEnum.TOKEN_INVALID.getMsg());
response.getWriter().print(JSON.toJSONString(result));