Merge remote-tracking branch 'origin/test' into test
# Conflicts: # src/main/java/com/sqx/modules/redisService/impl/RedisServiceImpl.java
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package com.sqx.common.aspect;
|
package com.sqx.common.aspect;
|
||||||
|
|
||||||
import com.sqx.common.annotation.Debounce;
|
import com.sqx.common.annotation.Debounce;
|
||||||
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.common.utils.SpelUtil;
|
import com.sqx.common.utils.SpelUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
import org.aspectj.lang.ProceedingJoinPoint;
|
||||||
@@ -76,7 +77,7 @@ public class DebounceAspect {
|
|||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
// 在防抖间隔内,不执行目标方法,直接返回
|
// 在防抖间隔内,不执行目标方法,直接返回
|
||||||
return null;
|
return Result.error("请求频繁,请重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object debounceForSpecificValue(ProceedingJoinPoint joinPoint, String methodSignature, long interval, TimeUnit timeUnit, Object targetValue) throws Throwable {
|
private Object debounceForSpecificValue(ProceedingJoinPoint joinPoint, String methodSignature, long interval, TimeUnit timeUnit, Object targetValue) throws Throwable {
|
||||||
@@ -89,7 +90,7 @@ public class DebounceAspect {
|
|||||||
return joinPoint.proceed();
|
return joinPoint.proceed();
|
||||||
}
|
}
|
||||||
// 在防抖间隔内,不执行目标方法,直接返回
|
// 在防抖间隔内,不执行目标方法,直接返回
|
||||||
return null;
|
return Result.error("请求频繁,请重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void cleanExpiredRecords() {
|
public void cleanExpiredRecords() {
|
||||||
|
|||||||
@@ -44,9 +44,8 @@ public class AppUserPrizeExchangeController {
|
|||||||
@PostMapping("/exchange")
|
@PostMapping("/exchange")
|
||||||
@ApiOperation("兑换")
|
@ApiOperation("兑换")
|
||||||
public Result exchange(@RequestAttribute("userId") Long userId, @RequestBody UserPrizeExchange entity) {
|
public Result exchange(@RequestAttribute("userId") Long userId, @RequestBody UserPrizeExchange entity) {
|
||||||
//userPrizeExchangeService.exchange(userId, entity);
|
userPrizeExchangeService.exchange(userId, entity);
|
||||||
//return Result.success();
|
return Result.success();
|
||||||
return Result.error("奖品正在路上,请耐心等待");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Login
|
@Login
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public class WuyouController {
|
|||||||
return Result.error("订单已支付");
|
return Result.error("订单已支付");
|
||||||
}
|
}
|
||||||
if (redisService.setCreateOrderFlagAndCheckLimit(order.getUserId(), orderId)) {
|
if (redisService.setCreateOrderFlagAndCheckLimit(order.getUserId(), orderId)) {
|
||||||
userService.addBlackUser(order.getUserId(), "一分钟频繁下单超12次");
|
userService.addBlackUser(order.getUserId(), "一分钟频繁下单超22次");
|
||||||
}
|
}
|
||||||
|
|
||||||
PayDetails payDetails = payDetailsDao.selectByOrderId(order.getOrdersNo());
|
PayDetails payDetails = payDetailsDao.selectByOrderId(order.getOrdersNo());
|
||||||
|
|||||||
@@ -353,6 +353,6 @@ public class RedisServiceImpl implements RedisService {
|
|||||||
String key = "createOrder:" + userId + ":" + orderId;
|
String key = "createOrder:" + userId + ":" + orderId;
|
||||||
redisTemplate.opsForValue().set(key, orderId.toString(), 60, TimeUnit.SECONDS);
|
redisTemplate.opsForValue().set(key, orderId.toString(), 60, TimeUnit.SECONDS);
|
||||||
Set<String> keys = redisTemplate.keys("createOrder:" + userId + ":*");
|
Set<String> keys = redisTemplate.keys("createOrder:" + userId + ":*");
|
||||||
return keys != null && keys.size() > 12;
|
return keys != null && keys.size() > 22;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user