From 6d9e2963d8dfce0d677394af43ad5642e93ceb55 Mon Sep 17 00:00:00 2001 From: wangw <1594593906@qq.com> Date: Sat, 24 May 2025 15:25:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8B=89=E9=BB=91/=E5=B0=81=E7=A6=81=E7=94=A8?= =?UTF-8?q?=E6=88=B7=20=E8=A7=A6=E5=8F=91=E5=AE=A2=E6=9C=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sqx/common/aspect/AppApiMethodAspect.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java b/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java index 346c1cc2..f24eb2e8 100644 --- a/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java +++ b/src/main/java/com/sqx/common/aspect/AppApiMethodAspect.java @@ -49,18 +49,21 @@ public class AppApiMethodAspect { @Around("pkg()") public Object around(ProceedingJoinPoint pjp) throws Throwable { HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); - String token = request.getHeader("token"); - if (StringUtils.isNotBlank(token)) { - Claims claims = jwtUtils.getClaimByToken(token); - if (claims != null && !jwtUtils.isTokenExpired(claims.getExpiration())) { - Long userId = Long.parseLong(claims.getSubject()); - UserEntity userInfo = userService.selectUserById(userId); - if (userInfo == null) { - throw new CzgException("用户不存在"); - } else if (userInfo.getStatus() == 0) { - throw new UserException("用户被拉黑", 701); - } else if (userInfo.getStatus() == 2) { - throw new UserException("用户被禁用", 702); + String requestUrl = request.getRequestURL().toString(); + if (!requestUrl.contains("common/")) { + String token = request.getHeader("token"); + if (StringUtils.isNotBlank(token)) { + Claims claims = jwtUtils.getClaimByToken(token); + if (claims != null && !jwtUtils.isTokenExpired(claims.getExpiration())) { + Long userId = Long.parseLong(claims.getSubject()); + UserEntity userInfo = userService.selectUserById(userId); + if (userInfo == null) { + throw new CzgException("用户不存在"); + } else if (userInfo.getStatus() == 0) { + throw new UserException("用户被拉黑", 701); + } else if (userInfo.getStatus() == 2) { + throw new UserException("用户被禁用", 702); + } } } } @@ -90,7 +93,6 @@ public class AppApiMethodAspect { String value = commonInfoService.findOne(933).getValue(); if ("1".equals(value)) { String method = request.getMethod(); - String requestUrl = request.getRequestURL().toString(); long useTime = end - start; ThreadUtil.execAsync(() -> { //请求的参数