From 16d8b71e21dc7298b30f46bf264cd9b3589a6978 Mon Sep 17 00:00:00 2001
From: who's hu <hup_dev@outlook.com>
Date: Tue, 22 Aug 2023 17:25:19 +0800
Subject: [PATCH] update ruoyi-ui/src/permission.js. 由于重定向url存在 http://xxx.xx.xxx/{id}?param={a}&name={b} 的场景, 当未登录访问时, 通过改js封装登录后重定向参数, 会丢失?后的query params 如: 访问 http://localhost:1024/core/doc/doc?id=1683734914907807745&version=31 期望 http://localhost:1024/login?redirect=%2Fcore%2Fdoc%2Fdoc%3Fid%3D1683734914907807745%26version%3D31 实际通过 to.fullPath 封装后 获得 http://localhost:1024/login?redirect=%2Fcore%2Fdoc%2Fdoc%3Fid%3D1683734914907807745&version=31
---
ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java | 16 ++++++----------
1 files changed, 6 insertions(+), 10 deletions(-)
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
index 33c9c87..316a370 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/interceptor/impl/SameUrlDataInterceptor.java
@@ -7,9 +7,9 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.annotation.RepeatSubmit;
-import com.ruoyi.common.constant.Constants;
+import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.filter.RepeatedlyRequestWrapper;
import com.ruoyi.common.utils.StringUtils;
@@ -50,7 +50,7 @@
// body参数为空,获取Parameter的数据
if (StringUtils.isEmpty(nowParams))
{
- nowParams = JSONObject.toJSONString(request.getParameterMap());
+ nowParams = JSON.toJSONString(request.getParameterMap());
}
Map<String, Object> nowDataMap = new HashMap<String, Object>();
nowDataMap.put(REPEAT_PARAMS, nowParams);
@@ -60,14 +60,10 @@
String url = request.getRequestURI();
// 唯一值(没有消息头则使用请求地址)
- String submitKey = request.getHeader(header);
- if (StringUtils.isEmpty(submitKey))
- {
- submitKey = url;
- }
+ String submitKey = StringUtils.trimToEmpty(request.getHeader(header));
- // 唯一标识(指定key + 消息头)
- String cacheRepeatKey = Constants.REPEAT_SUBMIT_KEY + submitKey;
+ // 唯一标识(指定key + url + 消息头)
+ String cacheRepeatKey = CacheConstants.REPEAT_SUBMIT_KEY + url + submitKey;
Object sessionObj = redisCache.getCacheObject(cacheRepeatKey);
if (sessionObj != null)
--
Gitblit v1.9.2