Browse Source

update 防重复提交标识组合 改为 key + url + header

疯狂的狮子li 3 năm trước cách đây
mục cha
commit
fc8c96399f

+ 4 - 6
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/RepeatSubmitAspect.java

@@ -57,13 +57,11 @@ public class RepeatSubmitAspect {
         String url = request.getRequestURI();
 
         // 唯一值(没有消息头则使用请求地址)
-        String submitKey = request.getHeader(tokenProperties.getHeader());
-        if (StringUtils.isEmpty(submitKey)) {
-            submitKey = url;
-        }
+        String submitKey = StringUtils.trimToEmpty(request.getHeader(tokenProperties.getHeader()));
+
         submitKey = SecureUtil.md5(submitKey + ":" + nowParams);
-        // 唯一标识(指定key + 消息头)
-        String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + submitKey;
+        // 唯一标识(指定key + url + 消息头)
+        String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + url + submitKey;
         String key = RedisUtils.getCacheObject(cacheRepeatKey);
         if (key == null) {
             RedisUtils.setCacheObject(cacheRepeatKey, "", interval, TimeUnit.MILLISECONDS);