diff --git a/Src/Dlhis.Basic/BusinessPlace/Controllers/BusinessPlacesController.cs b/Src/Dlhis.Basic/BusinessPlace/Controllers/BusinessPlacesController.cs
index 815f4e08..63dd5b4b 100644
--- a/Src/Dlhis.Basic/BusinessPlace/Controllers/BusinessPlacesController.cs
+++ b/Src/Dlhis.Basic/BusinessPlace/Controllers/BusinessPlacesController.cs
@@ -2,7 +2,7 @@
using Dlhis.Basic.BusinessPlace.Response;
using Dlhis.Basic.BusinessPlace.Services;
using Dlhis.Basic.BusinessShift.Services;
-using Dlhis.Basic.Packs;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.Basic/BusinessShift/Controllers/BusinessShiftsController.cs b/Src/Dlhis.Basic/BusinessShift/Controllers/BusinessShiftsController.cs
index 323bb7bb..981c650b 100644
--- a/Src/Dlhis.Basic/BusinessShift/Controllers/BusinessShiftsController.cs
+++ b/Src/Dlhis.Basic/BusinessShift/Controllers/BusinessShiftsController.cs
@@ -1,7 +1,7 @@
using Dlhis.Basic.BusinessShift.Request;
using Dlhis.Basic.BusinessShift.Response;
using Dlhis.Basic.BusinessShift.Services;
-using Dlhis.Basic.Packs;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs b/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs
index 29796a25..5f6ac7f8 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DeviceGroupsController.cs
@@ -1,8 +1,8 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Device.Services;
-using Dlhis.Basic.Packs;
using Dlhis.Entity.Device.Enums;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs
index 9462d88e..fffc51f0 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DevicePermissionsController.cs
@@ -3,6 +3,7 @@ using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Device.Services;
using Dlhis.Basic.Packs;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
index f4bf018d..9829ea9a 100644
--- a/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
+++ b/Src/Dlhis.Basic/Device/Controllers/DevicesController.cs
@@ -1,7 +1,7 @@
using Dlhis.Basic.Device.Request;
using Dlhis.Basic.Device.Response;
using Dlhis.Basic.Device.Services;
-using Dlhis.Basic.Packs;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.Basic/Dlhis.Basic.csproj b/Src/Dlhis.Basic/Dlhis.Basic.csproj
index a9a3c3da..7094a50f 100644
--- a/Src/Dlhis.Basic/Dlhis.Basic.csproj
+++ b/Src/Dlhis.Basic/Dlhis.Basic.csproj
@@ -17,9 +17,7 @@
-
-
-
+
diff --git a/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs b/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs
index 6ef9aed1..3e04aa6d 100644
--- a/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs
+++ b/Src/Dlhis.Basic/Organization/Controllers/GainfoCardsController.cs
@@ -1,7 +1,7 @@
using Dlhis.Basic.Organization.Request;
using Dlhis.Basic.Organization.Response;
using Dlhis.Basic.Organization.Services;
-using Dlhis.Basic.Packs;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.Basic/Packs/DataProtectionJob.cs b/Src/Dlhis.Basic/Packs/DataProtectionJob.cs
deleted file mode 100644
index 9bb6e44b..00000000
--- a/Src/Dlhis.Basic/Packs/DataProtectionJob.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Kurisu.AspNetCore.Startup;
-using Kurisu.AspNetCore.Utils;
-using Microsoft.AspNetCore.DataProtection;
-using StackExchange.Redis;
-
-namespace Dlhis.Basic.Packs;
-
-public class DataProtectionJobPack : BaseAppPack
-{
- public override bool IsBeforeUseRouting { get; }
-
- public override void ConfigureServices(IServiceCollection services)
- {
- var redisConnection = ConnectionMultiplexer.Connect(Configuration.GetSection($"{nameof(RedisOptions)}:{nameof(RedisOptions.ConnectionString)}").Value);
- services.AddDataProtection()
- .SetApplicationName("yiliantong")
- .PersistKeysToStackExchangeRedis(redisConnection, "DataProtection-Keys");
- }
-}
diff --git a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs
index 6979080e..64d5b2aa 100644
--- a/Src/Dlhis.Basic/Packs/SqlSugarPack.cs
+++ b/Src/Dlhis.Basic/Packs/SqlSugarPack.cs
@@ -68,99 +68,4 @@ public class SqlSugarPack : BaseAppPack
faceDb.Client.DbMaintenance.CreateDatabase();
faceDb.Client.CodeFirst.InitTables();
}
-}
-
-
-///
-/// 日志
-///
-[AttributeUsage(AttributeTargets.Method)]
-public class LogAttribute : Attribute, IAsyncActionFilter
-{
- public LogAttribute(string title)
- {
- Title = title;
- }
-
- ///
- ///
- ///
- public string Title { get; set; }
-
- ///
- /// 是否处理差异
- ///
- public bool Diff { get; set; }
-
-
- public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- PreSetting(context.HttpContext);
- await next();
- }
-
- private void PreSetting(HttpContext httpContext)
- {
- var options = httpContext.RequestServices.GetService();
-
- options.Title = Title;
- options.Diff = Diff;
- options.BatchNo = Guid.NewGuid();
- options.RoutePath = httpContext.Request.Path.Value;
- options.RaiseTime = DateTime.Now;
- }
-}
-
-///
-/// 事务
-///
-[AttributeUsage(AttributeTargets.Method)]
-public class TransactionalAttribute : Attribute, IAsyncActionFilter
-{
- public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- var dbContext = context.HttpContext.RequestServices.GetRequiredService();
- await dbContext.Ado.BeginTranAsync();
- try
- {
- var result = await next();
- if (result.Exception != null)
- {
- throw result.Exception;
- }
- else
- {
- await dbContext.Ado.CommitTranAsync();
- }
- }
- catch (Exception)
- {
- await dbContext.Ado.RollbackTranAsync();
- throw;
- }
- }
-}
-
-///
-/// 忽略租户
-///
-[AttributeUsage(AttributeTargets.Method)]
-public class IgnoreTenantAttribute : Attribute, IAsyncActionFilter
-{
- public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- var dbContext = context.HttpContext.RequestServices.GetRequiredService();
- var options = context.HttpContext!.RequestServices.GetService();
- try
- {
- dbContext.QueryFilter.ClearAndBackup();
- options.IgnoreTenant = true;
- await next();
- }
- finally
- {
- options.IgnoreTenant = false;
- dbContext.QueryFilter.Restore();
- }
- }
-}
+}
\ No newline at end of file
diff --git a/Src/Dlhis.Basic/appsettings.json b/Src/Dlhis.Basic/appsettings.json
index 6e58507c..79da19b2 100644
--- a/Src/Dlhis.Basic/appsettings.json
+++ b/Src/Dlhis.Basic/appsettings.json
@@ -14,6 +14,10 @@
"Url": "https://yikatong.isawesome.cn/api/basic/gainfos/face?token=",
"Limit": 7200
},
+ "DataProtectionOptions": {
+ "Enable": true,
+ "AppName": "yiliantong"
+ },
"SqlSugarOptions": {
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
"SlaveConnectionString": [],
diff --git a/Src/Dlhis.Canteen/Dlhis.Canteen.csproj b/Src/Dlhis.Canteen/Dlhis.Canteen.csproj
index cb61b6a5..f30be7d1 100644
--- a/Src/Dlhis.Canteen/Dlhis.Canteen.csproj
+++ b/Src/Dlhis.Canteen/Dlhis.Canteen.csproj
@@ -36,8 +36,7 @@
-
-
+
diff --git a/Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj b/Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj
index 26abb5b7..314a11ed 100644
--- a/Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj
+++ b/Src/Dlhis.Common.Api/Dlhis.Common.Api.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/Src/Dlhis.Common/Dlhis.Common.csproj b/Src/Dlhis.Common/Dlhis.Common.csproj
index 3ca7f20f..d3228328 100644
--- a/Src/Dlhis.Common/Dlhis.Common.csproj
+++ b/Src/Dlhis.Common/Dlhis.Common.csproj
@@ -21,7 +21,7 @@
-
+
diff --git a/Src/Dlhis.Entity/Dlhis.Entity.csproj b/Src/Dlhis.Entity/Dlhis.Entity.csproj
index 09f988da..8000930a 100644
--- a/Src/Dlhis.Entity/Dlhis.Entity.csproj
+++ b/Src/Dlhis.Entity/Dlhis.Entity.csproj
@@ -11,7 +11,7 @@
-
+
diff --git a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs
index edbbacb7..a463aeac 100644
--- a/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs
+++ b/Src/Dlhis.ScheduledTask/DeviceUploadLog/Controllers/DeviceUploadLogsController.cs
@@ -1,7 +1,7 @@
using Dlhis.ScheduledTask.DeviceUploadLog.Request;
using Dlhis.ScheduledTask.DeviceUploadLog.Response;
using Dlhis.ScheduledTask.DeviceUploadLog.Services;
-using Dlhis.ScheduledTask.Packs;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Kurisu.Core.DataAccess.Dto;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj
index 03b573b7..e412c478 100644
--- a/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj
+++ b/Src/Dlhis.ScheduledTask/Dlhis.ScheduledTask.csproj
@@ -20,8 +20,7 @@
-
-
+
diff --git a/Src/Dlhis.ScheduledTask/Packs/DataProtectionJob.cs b/Src/Dlhis.ScheduledTask/Packs/DataProtectionJob.cs
deleted file mode 100644
index 03d87356..00000000
--- a/Src/Dlhis.ScheduledTask/Packs/DataProtectionJob.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using Kurisu.AspNetCore.Startup;
-using Kurisu.AspNetCore.Utils;
-using Microsoft.AspNetCore.DataProtection;
-using StackExchange.Redis;
-
-namespace Dlhis.ScheduledTask.Packs;
-
-public class DataProtectionJobPack : BaseAppPack
-{
- public override bool IsBeforeUseRouting { get; }
-
- public override void ConfigureServices(IServiceCollection services)
- {
- var redisConnection = ConnectionMultiplexer.Connect(Configuration.GetSection($"{nameof(RedisOptions)}:{nameof(RedisOptions.ConnectionString)}").Value);
- services.AddDataProtection()
- .SetApplicationName("scheduled")
- .PersistKeysToStackExchangeRedis(redisConnection, "DataProtection-Keys");
- }
-}
diff --git a/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs b/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
index 2f562f2b..24a3f080 100644
--- a/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
+++ b/Src/Dlhis.ScheduledTask/Packs/SqlSugarPack.cs
@@ -1,9 +1,5 @@
using Kurisu.AspNetCore.Startup;
-using Kurisu.Core.DataAccess.Entity;
using Kurisu.SqlSugar.Extensions;
-using Kurisu.SqlSugar.Services;
-using Microsoft.AspNetCore.Mvc.Filters;
-using SqlSugar;
namespace Dlhis.ScheduledTask.Packs;
@@ -16,103 +12,3 @@ public class SqlSugarPack : BaseAppPack
services.AddSqlSugar();
}
}
-
-
-
-
-
-
-///
-/// 日志
-///
-[AttributeUsage(AttributeTargets.Method)]
-public class LogAttribute : Attribute, IAsyncActionFilter
-{
- public LogAttribute(string title)
- {
- Title = title;
- }
-
- ///
- ///
- ///
- public string Title { get; set; }
-
- ///
- /// 是否处理差异
- ///
- public bool Diff { get; set; }
-
-
- public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- PreSetting(context.HttpContext);
- await next();
- }
-
- private void PreSetting(HttpContext httpContext)
- {
- var options = httpContext.RequestServices.GetService();
-
- options.Title = Title;
- options.Diff = Diff;
- options.BatchNo = Guid.NewGuid();
- options.RoutePath = httpContext.Request.Path.Value;
- options.RaiseTime = DateTime.Now;
- }
-}
-
-///
-/// 事务
-///
-[AttributeUsage(AttributeTargets.Method)]
-public class TransactionalAttribute : Attribute, IAsyncActionFilter
-{
- public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- var dbContext = context.HttpContext.RequestServices.GetRequiredService();
- await dbContext.Ado.BeginTranAsync();
- try
- {
- var result = await next();
- if (result.Exception != null)
- {
- throw result.Exception;
- }
- else
- {
- await dbContext.Ado.CommitTranAsync();
- }
- }
- catch (Exception)
- {
- await dbContext.Ado.RollbackTranAsync();
- throw;
- }
- }
-}
-
-///
-/// 忽略租户
-///
-[AttributeUsage(AttributeTargets.Method)]
-public class IgnoreTenantAttribute : Attribute, IAsyncActionFilter
-{
- public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
- {
- var dbContext = context.HttpContext.RequestServices.GetRequiredService();
- var options = context.HttpContext!.RequestServices.GetService();
- try
- {
- dbContext.QueryFilter.ClearAndBackup();
- options.IgnoreTenant = true;
- await next();
- }
- finally
- {
- options.IgnoreTenant = false;
- dbContext.QueryFilter.Restore();
- }
- }
-}
-
diff --git a/Src/Dlhis.ScheduledTask/Program.cs b/Src/Dlhis.ScheduledTask/Program.cs
index 64b4094a..9f35b5ee 100644
--- a/Src/Dlhis.ScheduledTask/Program.cs
+++ b/Src/Dlhis.ScheduledTask/Program.cs
@@ -23,12 +23,6 @@ public class Startup : DefaultStartup
{
base.ConfigureServices(services);
services.AddRedis();
-
- var reidConnection = Configuration.GetSection($"{nameof(RedisOptions)}:{nameof(RedisOptions.ConnectionString)}").Value;
- var redis = ConnectionMultiplexer.Connect(reidConnection);
- services.AddDataProtection()
- .SetApplicationName("yiliantong")
- .PersistKeysToStackExchangeRedis(redis, "DataProtection-Keys");
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
diff --git a/Src/Dlhis.ScheduledTask/Properties/launchSettings.json b/Src/Dlhis.ScheduledTask/Properties/launchSettings.json
index a6ea1802..fd368e29 100644
--- a/Src/Dlhis.ScheduledTask/Properties/launchSettings.json
+++ b/Src/Dlhis.ScheduledTask/Properties/launchSettings.json
@@ -5,7 +5,7 @@
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
- "applicationUrl": "http://*:5010"
+ "applicationUrl": "http://localhost:5010"
}
}
}
\ No newline at end of file
diff --git a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
index fb9b7e2a..f49e4ee8 100644
--- a/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
+++ b/Src/Dlhis.ScheduledTask/TaskAssignment/Controllers/AssignmentsController.cs
@@ -1,7 +1,7 @@
-using Dlhis.ScheduledTask.Packs;
-using Dlhis.ScheduledTask.TaskAssignment.Request;
+using Dlhis.ScheduledTask.TaskAssignment.Request;
using Dlhis.ScheduledTask.TaskAssignment.Response;
using Dlhis.ScheduledTask.TaskAssignment.Services;
+using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
diff --git a/Src/Dlhis.ScheduledTask/appsettings.json b/Src/Dlhis.ScheduledTask/appsettings.json
index 8c70547a..2514f898 100644
--- a/Src/Dlhis.ScheduledTask/appsettings.json
+++ b/Src/Dlhis.ScheduledTask/appsettings.json
@@ -8,6 +8,10 @@
"InternalRequest": {
"SysRequestUrl": "http://sys"
},
+ "DataProtectionOptions": {
+ "Enable": true,
+ "AppName": "yiliantong"
+ },
"SqlSugarOptions": {
"DefaultConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=yikatong;charset=utf8mb4;",
"SlaveConnectionString": [],
diff --git a/Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj b/Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj
index 71b4a337..50a74ddd 100644
--- a/Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj
+++ b/Src/Dlhis.Sys.Api/Dlhis.Sys.Api.csproj
@@ -7,7 +7,7 @@
-
+
diff --git a/Src/Dlhis.Sys/Dlhis.Sys.csproj b/Src/Dlhis.Sys/Dlhis.Sys.csproj
index bb2fec72..830d7da2 100644
--- a/Src/Dlhis.Sys/Dlhis.Sys.csproj
+++ b/Src/Dlhis.Sys/Dlhis.Sys.csproj
@@ -17,8 +17,7 @@
-
-
+
diff --git a/Src/Dlhis.User/Dlhis.User.csproj b/Src/Dlhis.User/Dlhis.User.csproj
index b1381bb6..a803e35b 100644
--- a/Src/Dlhis.User/Dlhis.User.csproj
+++ b/Src/Dlhis.User/Dlhis.User.csproj
@@ -17,7 +17,6 @@
-
-
+