频率限制7
This commit is contained in:
@@ -2,7 +2,9 @@ package com.sqx.common.aspect;
|
||||
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import com.sqx.common.annotation.Limiting;
|
||||
import com.sqx.common.exception.CzgException;
|
||||
import com.sqx.common.utils.IPUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.Signature;
|
||||
@@ -56,7 +58,7 @@ public class RateLimitAspect {
|
||||
} else {
|
||||
// 未获取到许可,抛出异常或返回错误信息
|
||||
log.info("IP: {} 请求方法: {} 超过访问频率限制", ip, method.getName());
|
||||
throw new RuntimeException("访问频率过高,请稍后再试");
|
||||
throw new CzgException("访问频率过高,请稍后再试");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user