diff --git a/luoo_user/src/main/java/com/luoo/user/aspect/OperationAspect.java b/luoo_user/src/main/java/com/luoo/user/aspect/OperationAspect.java index 71ec7b5..ee64ac7 100644 --- a/luoo_user/src/main/java/com/luoo/user/aspect/OperationAspect.java +++ b/luoo_user/src/main/java/com/luoo/user/aspect/OperationAspect.java @@ -85,9 +85,7 @@ public class OperationAspect { } private void checkRequestFrequency(String fullMethodName, RequestFrequencyTypeEnum frequencyTyp, Integer threshold) { HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String ip = getIpAddr(request); - ip = ip.replace(":", ""); - String redisKey = fullMethodName + ip; + String redisKey = fullMethodName + getKey(request); Object count=redisUtils.get(redisKey); Integer cuCount= null==count?0:Integer.valueOf((String)count); if (cuCount != null && cuCount > threshold - 1) { @@ -95,6 +93,10 @@ public class OperationAspect { } redisUtils.increment(redisKey, 1, frequencyTyp.getSeconds()); } + private String getKey(HttpServletRequest request) { + String mobile = request.getParameter("mobile"); + return StringTools.isEmpty(mobile)?getIpAddr(request).replace(":", ""): mobile; + } private void checkAppUserLogin() { UserLoginDto userLoginDto = getUserLoginDtoFromToken(); if (userLoginDto == null) {