diff --git a/IRaCIS.Core.API/IRaCIS.Core.API.csproj b/IRaCIS.Core.API/IRaCIS.Core.API.csproj
index 8bdddbe5f..5a7be3fe9 100644
--- a/IRaCIS.Core.API/IRaCIS.Core.API.csproj
+++ b/IRaCIS.Core.API/IRaCIS.Core.API.csproj
@@ -71,6 +71,7 @@
+
diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs
index 50cb855b4..40ffb2743 100644
--- a/IRaCIS.Core.API/Progranm.cs
+++ b/IRaCIS.Core.API/Progranm.cs
@@ -28,6 +28,7 @@ using FellowOakDicom.Network;
using IRaCIS.Core.Application.Service.ImageAndDoc;
using IP2Region.Net.Abstractions;
using IP2Region.Net.XDB;
+using IRaCIS.Core.Application.BusinessFilter;
#region 获取环境变量
@@ -104,11 +105,9 @@ builder.Services.AddControllers(options =>
options.Filters.Add();
options.Filters.Add();
options.Filters.Add();
+ options.Filters.Add(10);
+ options.Filters.Add();
- if (_configuration.GetSection("BasicSystemConfig").GetValue("OpenLoginLimit"))
- {
- options.Filters.Add();
- }
})
.AddNewtonsoftJsonSetup(builder.Services); // NewtonsoftJson 序列化 处理
@@ -117,6 +116,8 @@ builder.Services.AddOptions().Configure(_configuration.Ge
builder.Services.AddOptions().Configure(_configuration.GetSection("BasicSystemConfig"));
builder.Services.AddOptions().Configure(_configuration.GetSection("AliyunOSS"));
builder.Services.AddOptions().Configure(_configuration.GetSection("ObjectStoreService"));
+builder.Services.AddOptions().Configure(_configuration.GetSection("EncrypteResponseConfig"));
+
//动态WebApi + UnifiedApiResultFilter 省掉控制器代码
@@ -297,7 +298,7 @@ try
- var server = DicomServerFactory.Create(11112,userState: app.Services);
+ var server = DicomServerFactory.Create(11112, userState: app.Services);
app.Run();
diff --git a/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs b/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs
index 00b718e2c..e2dc37494 100644
--- a/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs
+++ b/IRaCIS.Core.API/_ServiceExtensions/hangfireSetup.cs
@@ -3,6 +3,7 @@ using Hangfire.SqlServer;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
+using System.Runtime.InteropServices;
namespace IRaCIS.Core.API
{
@@ -14,19 +15,29 @@ namespace IRaCIS.Core.API
services.AddHangfire(hangFireConfig =>
{
-
- //hangFireConfig.UseInMemoryStorage();
-
- //指定存储介质
- hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions()
+ //本地window 调试 使用内存,服务器部署使用数据库,防止服务器任务调度到本地
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- SchemaName = "dbo",
- CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
- SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
- QueuePollInterval = TimeSpan.Zero,
- UseRecommendedIsolationLevel = true,
- DisableGlobalLocks = true
- });
+ hangFireConfig.UseInMemoryStorage();
+
+ }
+ else
+ {
+ //指定存储介质
+ hangFireConfig.UseSqlServerStorage(hangFireConnStr, new SqlServerStorageOptions()
+ {
+ SchemaName = "dbo",
+ CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
+ SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
+ QueuePollInterval = TimeSpan.Zero,
+ UseRecommendedIsolationLevel = true,
+ DisableGlobalLocks = true
+ });
+ }
+
+
+
+
//hangFireConfig.UseTagsWithSql(); //nuget引入Hangfire.Tags.SqlServer
//.UseHangfireHttpJob();
diff --git a/IRaCIS.Core.API/appsettings.json b/IRaCIS.Core.API/appsettings.json
index b6d0f4125..59dd671c2 100644
--- a/IRaCIS.Core.API/appsettings.json
+++ b/IRaCIS.Core.API/appsettings.json
@@ -92,5 +92,12 @@
"DefaultPassword": "123456",
"DefaultInternalOrganizationName": "ExtImaging",
"ImageShareExpireDays": 10
+ },
+
+ "EncrypteResponseConfig": {
+ "IsEnable": true,
+ "ApiPathList": [
+ "/test/get"
+ ]
}
}
\ No newline at end of file
diff --git a/IRaCIS.Core.Application/BusinessFilter/EncreptApiResultFilter.cs b/IRaCIS.Core.Application/BusinessFilter/EncreptApiResultFilter.cs
new file mode 100644
index 000000000..fd58ae885
--- /dev/null
+++ b/IRaCIS.Core.Application/BusinessFilter/EncreptApiResultFilter.cs
@@ -0,0 +1,71 @@
+using IRaCIS.Core.Domain.Share;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.AspNetCore.Mvc.Filters;
+using Microsoft.Extensions.Options;
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace IRaCIS.Core.Application.BusinessFilter
+{
+ public class EncreptApiResultFilter : IAsyncResultFilter
+ {
+
+ private readonly IOptionsMonitor _encreptResponseMonitor;
+
+ public EncreptApiResultFilter(IOptionsMonitor encreptResponseMonitor)
+ {
+ _encreptResponseMonitor = encreptResponseMonitor;
+ }
+
+ public async Task OnResultExecutionAsync(ResultExecutingContext context, ResultExecutionDelegate next)
+ {
+
+ if(_encreptResponseMonitor.CurrentValue.IsEnable)
+ {
+
+ if (context.Result is ObjectResult objectResult)
+ {
+ var statusCode = objectResult.StatusCode ?? context.HttpContext.Response.StatusCode;
+
+ var objectValue = objectResult.Value;
+
+
+ if (objectValue is IResponseOutput)
+ {
+ var responseOutput = objectValue as IResponseOutput