From 6ca853516671882e8e54d9630a4299f12fbcf9aa Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 13 一月 2022 11:14:33 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/satoken' into dev --- ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java | 13 +++++-------- 1 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java index 5c249a2..9fa586b 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java @@ -1,10 +1,10 @@ package com.ruoyi.framework.aspectj; +import cn.dev33.satoken.SaManager; import cn.hutool.crypto.SecureUtil; import com.ruoyi.common.annotation.RepeatSubmit; import com.ruoyi.common.constant.Constants; import com.ruoyi.common.exception.ServiceException; -import com.ruoyi.common.properties.TokenProperties; import com.ruoyi.common.utils.JsonUtils; import com.ruoyi.common.utils.redis.RedisUtils; import com.ruoyi.common.utils.ServletUtils; @@ -37,7 +37,6 @@ @Component public class RepeatSubmitAspect { - private final TokenProperties tokenProperties; private final RepeatSubmitProperties repeatSubmitProperties; @Before("@annotation(repeatSubmit)") @@ -57,13 +56,11 @@ String url = request.getRequestURI(); // 鍞竴鍊硷紙娌℃湁娑堟伅澶村垯浣跨敤璇锋眰鍦板潃锛� - String submitKey = request.getHeader(tokenProperties.getHeader()); - if (StringUtils.isEmpty(submitKey)) { - submitKey = url; - } + String submitKey = StringUtils.trimToEmpty(request.getHeader(SaManager.getConfig().getTokenName())); + submitKey = SecureUtil.md5(submitKey + ":" + nowParams); - // 鍞竴鏍囪瘑锛堟寚瀹歬ey + 娑堟伅澶达級 - String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + submitKey; + // 鍞竴鏍囪瘑锛堟寚瀹歬ey + url + 娑堟伅澶达級 + String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey; String key = RedisUtils.getCacheObject(cacheRepeatKey); if (key == null) { RedisUtils.setCacheObject(cacheRepeatKey, "", interval, TimeUnit.MILLISECONDS); -- Gitblit v1.9.3