拉黑/封禁用户 触发客服

This commit is contained in:
wangw 2025-05-24 15:25:43 +08:00
parent bf3b249107
commit 6d9e2963d8
1 changed files with 15 additions and 13 deletions

View File

@ -49,18 +49,21 @@ public class AppApiMethodAspect {
@Around("pkg()") @Around("pkg()")
public Object around(ProceedingJoinPoint pjp) throws Throwable { public Object around(ProceedingJoinPoint pjp) throws Throwable {
HttpServletRequest request = HttpContextUtils.getHttpServletRequest(); HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
String token = request.getHeader("token"); String requestUrl = request.getRequestURL().toString();
if (StringUtils.isNotBlank(token)) { if (!requestUrl.contains("common/")) {
Claims claims = jwtUtils.getClaimByToken(token); String token = request.getHeader("token");
if (claims != null && !jwtUtils.isTokenExpired(claims.getExpiration())) { if (StringUtils.isNotBlank(token)) {
Long userId = Long.parseLong(claims.getSubject()); Claims claims = jwtUtils.getClaimByToken(token);
UserEntity userInfo = userService.selectUserById(userId); if (claims != null && !jwtUtils.isTokenExpired(claims.getExpiration())) {
if (userInfo == null) { Long userId = Long.parseLong(claims.getSubject());
throw new CzgException("用户不存在"); UserEntity userInfo = userService.selectUserById(userId);
} else if (userInfo.getStatus() == 0) { if (userInfo == null) {
throw new UserException("用户被拉黑", 701); throw new CzgException("用户不存在");
} else if (userInfo.getStatus() == 2) { } else if (userInfo.getStatus() == 0) {
throw new UserException("用户被禁用", 702); 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(); String value = commonInfoService.findOne(933).getValue();
if ("1".equals(value)) { if ("1".equals(value)) {
String method = request.getMethod(); String method = request.getMethod();
String requestUrl = request.getRequestURL().toString();
long useTime = end - start; long useTime = end - start;
ThreadUtil.execAsync(() -> { ThreadUtil.execAsync(() -> {
//请求的参数 //请求的参数