From 3607e008a3ea45ffe3c289786214f23404eeeb81 Mon Sep 17 00:00:00 2001 From: RuoYi <yzz_ivy@163.com> Date: 星期三, 28 九月 2022 19:32:55 +0800 Subject: [PATCH] 优化限流打印日志KEY(I5SQ09) --- ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java index 7727051..f06465f 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RateLimiterAspect.java @@ -4,10 +4,8 @@ import java.util.Collections; import java.util.List; import org.aspectj.lang.JoinPoint; -import org.aspectj.lang.Signature; import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; -import org.aspectj.lang.annotation.Pointcut; import org.aspectj.lang.reflect.MethodSignature; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -52,7 +50,6 @@ @Before("@annotation(rateLimiter)") public void doBefore(JoinPoint point, RateLimiter rateLimiter) throws Throwable { - String key = rateLimiter.key(); int time = rateLimiter.time(); int count = rateLimiter.count(); @@ -63,9 +60,9 @@ Long number = redisTemplate.execute(limitScript, keys, count, time); if (StringUtils.isNull(number) || number.intValue() > count) { - throw new ServiceException("璁块棶杩囦簬棰戠箒锛岃绋嶅悗鍐嶈瘯"); + throw new ServiceException("璁块棶杩囦簬棰戠箒锛岃绋嶅�欏啀璇�"); } - log.info("闄愬埗璇锋眰'{}',褰撳墠璇锋眰'{}',缂撳瓨key'{}'", count, number.intValue(), key); + log.info("闄愬埗璇锋眰'{}',褰撳墠璇锋眰'{}',缂撳瓨key'{}'", count, number.intValue(), combineKey); } catch (ServiceException e) { @@ -73,7 +70,7 @@ } catch (Exception e) { - throw new RuntimeException("鏈嶅姟鍣ㄩ檺娴佸紓甯革紝璇风◢鍚庡啀璇�"); + throw new RuntimeException("鏈嶅姟鍣ㄩ檺娴佸紓甯革紝璇风◢鍊欏啀璇�"); } } -- Gitblit v1.9.3