ip 请求次数限制22
This commit is contained in:
parent
e68ff1a9a9
commit
5848373764
|
|
@ -13,5 +13,5 @@ import java.lang.annotation.Target;
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
public @interface Limiting {
|
public @interface Limiting {
|
||||||
// 默认每秒放入桶中的token
|
// 默认每秒放入桶中的token
|
||||||
double limitNum() default 5;
|
double limitNum() default 10;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ public class DiscSpinningController {
|
||||||
@ApiImplicitParam(name = "source", value = "1 普通转盘 2 周任务转盘 3 月任务转盘", dataTypeClass = Integer.class),
|
@ApiImplicitParam(name = "source", value = "1 普通转盘 2 周任务转盘 3 月任务转盘", dataTypeClass = Integer.class),
|
||||||
})
|
})
|
||||||
@ApiOperation("查询大转盘")
|
@ApiOperation("查询大转盘")
|
||||||
@Debounce(interval = 3000, value = "#userId")
|
// @Debounce(interval = 3000, value = "#userId")
|
||||||
public Result appDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
public Result appDiscSpinning(@RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||||
PageHelper.startPage(1, 20);
|
PageHelper.startPage(1, 20);
|
||||||
List<DiscSpinning> list = discSpinningService.list(
|
List<DiscSpinning> list = discSpinningService.list(
|
||||||
|
|
@ -164,8 +164,8 @@ public class DiscSpinningController {
|
||||||
@ApiResponses({
|
@ApiResponses({
|
||||||
@ApiResponse(code = 200, message = "{\"sum\":\"总抽奖次数\",\"count\":\"剩余抽奖次数\"}"),
|
@ApiResponse(code = 200, message = "{\"sum\":\"总抽奖次数\",\"count\":\"剩余抽奖次数\"}"),
|
||||||
})
|
})
|
||||||
@Debounce(value = "#userId")
|
// @Debounce(value = "#userId")
|
||||||
@Limiting
|
// @Limiting
|
||||||
public Result drawCount(@ApiIgnore @RequestAttribute("userId") Long userId, @RequestParam(required = false, defaultValue = "1") Integer source) {
|
public Result drawCount(@ApiIgnore @RequestAttribute("userId") Long userId, @RequestParam(required = false, defaultValue = "1") Integer source) {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
|
int drawCount = Integer.parseInt(commonRepository.findOne(901).getValue());
|
||||||
|
|
@ -203,8 +203,8 @@ public class DiscSpinningController {
|
||||||
@ApiImplicitParam(name = "source", value = "1 普通转盘 2 周任务转盘 3 月任务转盘", dataTypeClass = Integer.class),
|
@ApiImplicitParam(name = "source", value = "1 普通转盘 2 周任务转盘 3 月任务转盘", dataTypeClass = Integer.class),
|
||||||
})
|
})
|
||||||
@ApiOperation("抽取大转盘")
|
@ApiOperation("抽取大转盘")
|
||||||
@Debounce(value = "#userId")
|
// @Debounce(value = "#userId")
|
||||||
@Limiting
|
// @Limiting
|
||||||
public Result draw(@ApiIgnore @RequestAttribute("userId") Long userId, @RequestParam(required = false, defaultValue = "1") Integer source) throws CzgException {
|
public Result draw(@ApiIgnore @RequestAttribute("userId") Long userId, @RequestParam(required = false, defaultValue = "1") Integer source) throws CzgException {
|
||||||
String lockKey = StrUtil.format("user:disc-spinning:limit:user:lock:{}", userId);
|
String lockKey = StrUtil.format("user:disc-spinning:limit:user:lock:{}", userId);
|
||||||
if (redisUtils.hasKey(lockKey)) {
|
if (redisUtils.hasKey(lockKey)) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue