Compare commits
No commits in common. "ca44b4786abd4cec9ea257ce1700ef3b09c2e4b5" and "e6aec6b559a13cc46deac60b5f39387d0085ff6b" have entirely different histories.
ca44b4786a
...
e6aec6b559
|
|
@ -101,7 +101,7 @@ builder.Services.AddControllers(options =>
|
||||||
options.Filters.Add<UnitOfWorkFilter>();
|
options.Filters.Add<UnitOfWorkFilter>();
|
||||||
options.Filters.Add<LimitUserRequestAuthorization>();
|
options.Filters.Add<LimitUserRequestAuthorization>();
|
||||||
options.Filters.Add<TrialGlobalLimitActionFilter>();
|
options.Filters.Add<TrialGlobalLimitActionFilter>();
|
||||||
options.Filters.Add<RequestDuplicationFilter>();
|
//options.Filters.Add<RequestDuplicationFilter>();
|
||||||
|
|
||||||
})
|
})
|
||||||
.AddNewtonsoftJsonSetup(builder.Services); // NewtonsoftJson 序列化 处理
|
.AddNewtonsoftJsonSetup(builder.Services); // NewtonsoftJson 序列化 处理
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@
|
||||||
// 是否启用重复请求检测
|
// 是否启用重复请求检测
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
// 重复请求时间窗口(毫秒)
|
// 重复请求时间窗口(毫秒)
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
// 缓存请求时间(秒)
|
// 缓存请求时间(秒)
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@
|
||||||
},
|
},
|
||||||
"RequestDuplicationOptions": {
|
"RequestDuplicationOptions": {
|
||||||
"IsEnabled": true,
|
"IsEnabled": true,
|
||||||
"DuplicationWindowMs": 200,
|
"DuplicationWindowMs": 500,
|
||||||
"CacheTimeSeconds": 5,
|
"CacheTimeSeconds": 5,
|
||||||
"ExcludedPaths": [
|
"ExcludedPaths": [
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,7 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
|
||||||
using Microsoft.AspNetCore.Components.Endpoints;
|
using Microsoft.AspNetCore.Components.Endpoints;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
|
||||||
using Microsoft.AspNetCore.Mvc.Filters;
|
using Microsoft.AspNetCore.Mvc.Filters;
|
||||||
using Microsoft.AspNetCore.Mvc.ModelBinding;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Options;
|
using Microsoft.Extensions.Options;
|
||||||
|
|
@ -50,20 +48,8 @@ namespace IRaCIS.Core.Application.BusinessFilter.LegacyController
|
||||||
/// <returns>返回的对象</returns>
|
/// <returns>返回的对象</returns>
|
||||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||||
{
|
{
|
||||||
Dictionary<string, object?> dic = new Dictionary<string, object?>();
|
this.Intoparam = JsonConvert.SerializeObject(
|
||||||
var desc = context.ActionDescriptor as ControllerActionDescriptor;
|
context.ActionArguments.TryGetValue("inQuery", out var v) ? v : null);
|
||||||
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
|
try
|
||||||
{
|
{
|
||||||
this.RequestDuplication();
|
this.RequestDuplication();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue