Commit 7870283bfa8a2b2242d6498e79d390d6271826d6

Authored by 芋道源码
Committed by Gitee
2 parents 91481709 2acf5c87

!594 兼容spring web 配置上下文根路径的情况

Merge pull request !594 from suyh/master
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
1 1 package cn.iocoder.yudao.framework.web.core.util;
2 2  
3 3 import cn.hutool.core.util.NumberUtil;
4   -import cn.hutool.core.util.StrUtil;
5 4 import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
6 5 import cn.iocoder.yudao.framework.common.pojo.CommonResult;
7 6 import cn.iocoder.yudao.framework.web.config.WebProperties;
... ... @@ -89,10 +88,10 @@ public class WebFrameworkUtils {
89 88 return userType;
90 89 }
91 90 // 2. 其次,基于 URL 前缀的约定
92   - if (request.getRequestURI().startsWith(properties.getAdminApi().getPrefix())) {
  91 + if (request.getServletPath().startsWith(properties.getAdminApi().getPrefix())) {
93 92 return UserTypeEnum.ADMIN.getValue();
94 93 }
95   - if (request.getRequestURI().startsWith(properties.getAppApi().getPrefix())) {
  94 + if (request.getServletPath().startsWith(properties.getAppApi().getPrefix())) {
96 95 return UserTypeEnum.MEMBER.getValue();
97 96 }
98 97 return null;
... ...