From 2acf5c878faec7002d1301bc654f89a720c586e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E4=BA=91=E5=BC=98?= Date: Sun, 27 Aug 2023 11:59:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9spring=20boot=20web=20?= =?UTF-8?q?=E6=8F=90=E4=BE=9B=E7=9A=84=E4=B8=8A=E4=B8=8B=E6=96=87=E6=A0=B9?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E7=9A=84=E5=8C=B9=E9=85=8D=20spring.servlet.?= =?UTF-8?q?content-path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/web/core/util/WebFrameworkUtils.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java index 3a2bea582..832b72fd8 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java @@ -1,7 +1,6 @@ package cn.iocoder.yudao.framework.web.core.util; import cn.hutool.core.util.NumberUtil; -import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.web.config.WebProperties; @@ -89,10 +88,10 @@ public class WebFrameworkUtils { return userType; } // 2. 其次,基于 URL 前缀的约定 - if (request.getRequestURI().startsWith(properties.getAdminApi().getPrefix())) { + if (request.getServletPath().startsWith(properties.getAdminApi().getPrefix())) { return UserTypeEnum.ADMIN.getValue(); } - if (request.getRequestURI().startsWith(properties.getAppApi().getPrefix())) { + if (request.getServletPath().startsWith(properties.getAppApi().getPrefix())) { return UserTypeEnum.MEMBER.getValue(); } return null;