From 74056167d650ea6d88103f99b5cc3ea60b63d32b Mon Sep 17 00:00:00 2001 From: he <109787524@qq.com> Date: Thu, 16 Oct 2025 14:28:15 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=AF=B7=E6=B1=82=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- IRaCIS.Core.API/Progranm.cs | 2 +- IRaCIS.Core.API/appsettings.Event_IRC.json | 2 +- IRaCIS.Core.API/appsettings.Prod_IRC.json | 2 +- IRaCIS.Core.API/appsettings.Test_IRC.json | 2 +- .../appsettings.Test_IRC_PGSQL.json | 2 +- IRaCIS.Core.API/appsettings.US_Prod_IRC.json | 2 +- IRaCIS.Core.API/appsettings.US_Test_IRC.json | 2 +- IRaCIS.Core.API/appsettings.US_Uat_IRC.json | 2 +- IRaCIS.Core.API/appsettings.Uat_IRC.json | 2 +- IRaCIS.Core.API/appsettings.json | 2 +- .../RequestDuplicationFilter.cs | 18 ++++++++++++++++-- 11 files changed, 26 insertions(+), 12 deletions(-) diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index 993353891..69be6d74f 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -101,7 +101,7 @@ builder.Services.AddControllers(options => options.Filters.Add(); options.Filters.Add(); options.Filters.Add(); - //options.Filters.Add(); + options.Filters.Add(); }) .AddNewtonsoftJsonSetup(builder.Services); // NewtonsoftJson 序列化 处理 diff --git a/IRaCIS.Core.API/appsettings.Event_IRC.json b/IRaCIS.Core.API/appsettings.Event_IRC.json index 6ec66b5b2..abb6b600e 100644 --- a/IRaCIS.Core.API/appsettings.Event_IRC.json +++ b/IRaCIS.Core.API/appsettings.Event_IRC.json @@ -72,7 +72,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.Prod_IRC.json b/IRaCIS.Core.API/appsettings.Prod_IRC.json index 9985c978b..27f02f53f 100644 --- a/IRaCIS.Core.API/appsettings.Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.Prod_IRC.json @@ -81,7 +81,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.Test_IRC.json b/IRaCIS.Core.API/appsettings.Test_IRC.json index a86722863..2257eb20a 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC.json @@ -166,7 +166,7 @@ // 是否启用重复请求检测 "IsEnabled": true, // 重复请求时间窗口(毫秒) - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, // 缓存请求时间(秒) "CacheTimeSeconds": 5, "ExcludedPaths": [ diff --git a/IRaCIS.Core.API/appsettings.Test_IRC_PGSQL.json b/IRaCIS.Core.API/appsettings.Test_IRC_PGSQL.json index 02bcd1cb8..cc576a790 100644 --- a/IRaCIS.Core.API/appsettings.Test_IRC_PGSQL.json +++ b/IRaCIS.Core.API/appsettings.Test_IRC_PGSQL.json @@ -94,7 +94,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.US_Prod_IRC.json b/IRaCIS.Core.API/appsettings.US_Prod_IRC.json index 286366cfc..b2b4de3fe 100644 --- a/IRaCIS.Core.API/appsettings.US_Prod_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Prod_IRC.json @@ -88,7 +88,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.US_Test_IRC.json b/IRaCIS.Core.API/appsettings.US_Test_IRC.json index df94467fb..8f64026a9 100644 --- a/IRaCIS.Core.API/appsettings.US_Test_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Test_IRC.json @@ -95,7 +95,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.US_Uat_IRC.json b/IRaCIS.Core.API/appsettings.US_Uat_IRC.json index 29856f89e..35dd18934 100644 --- a/IRaCIS.Core.API/appsettings.US_Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.US_Uat_IRC.json @@ -95,7 +95,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.Uat_IRC.json b/IRaCIS.Core.API/appsettings.Uat_IRC.json index 05eaba3c2..6f90ade78 100644 --- a/IRaCIS.Core.API/appsettings.Uat_IRC.json +++ b/IRaCIS.Core.API/appsettings.Uat_IRC.json @@ -102,7 +102,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.API/appsettings.json b/IRaCIS.Core.API/appsettings.json index 66c347795..5376f4890 100644 --- a/IRaCIS.Core.API/appsettings.json +++ b/IRaCIS.Core.API/appsettings.json @@ -77,7 +77,7 @@ }, "RequestDuplicationOptions": { "IsEnabled": true, - "DuplicationWindowMs": 500, + "DuplicationWindowMs": 200, "CacheTimeSeconds": 5, "ExcludedPaths": [ ] diff --git a/IRaCIS.Core.Application/BusinessFilter/LegacyController/RequestDuplicationFilter.cs b/IRaCIS.Core.Application/BusinessFilter/LegacyController/RequestDuplicationFilter.cs index 5f30d9315..ed574bd86 100644 --- a/IRaCIS.Core.Application/BusinessFilter/LegacyController/RequestDuplicationFilter.cs +++ b/IRaCIS.Core.Application/BusinessFilter/LegacyController/RequestDuplicationFilter.cs @@ -14,7 +14,9 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController using Microsoft.AspNetCore.Components.Endpoints; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; + using Microsoft.AspNetCore.Mvc.Controllers; using Microsoft.AspNetCore.Mvc.Filters; + using Microsoft.AspNetCore.Mvc.ModelBinding; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -48,8 +50,20 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController /// 返回的对象 public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) { - this.Intoparam = JsonConvert.SerializeObject( - context.ActionArguments.TryGetValue("inQuery", out var v) ? v : null); + Dictionary dic = new Dictionary(); + var desc = context.ActionDescriptor as ControllerActionDescriptor; + foreach (var p in desc.Parameters) + { + // 关键判断:绑定源是否是 Services + if (p.BindingInfo?.BindingSource == BindingSource.Services) continue; + // 普通参数,取值 + if (context.ActionArguments.TryGetValue(p.Name, out var value) && value != null) + { + dic.Add(p.Name, value); + } + } + + this.Intoparam = JsonConvert.SerializeObject(dic); try { this.RequestDuplication();