1.fix checkRequestFrequency leak

main
Gary 11 months ago
parent 8fe93a9d05
commit 16372254d2

@ -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) {

Loading…
Cancel
Save