diff --git a/apps/vue/src/api/logging/model/loggingModel.ts b/apps/vue/src/api/logging/model/loggingModel.ts index 3d1b3838e..b7a716cd8 100644 --- a/apps/vue/src/api/logging/model/loggingModel.ts +++ b/apps/vue/src/api/logging/model/loggingModel.ts @@ -11,6 +11,7 @@ export interface LogException { } export interface LogField { + id: string; machineName: string; environment: string; application: string; diff --git a/apps/vue/src/views/sys/logging/components/LoggingModal.vue b/apps/vue/src/views/sys/logging/components/LoggingModal.vue index 72158ddbb..30099612a 100644 --- a/apps/vue/src/views/sys/logging/components/LoggingModal.vue +++ b/apps/vue/src/views/sys/logging/components/LoggingModal.vue @@ -126,7 +126,7 @@ const [registerModal] = useModalInner((model) => { activeKey.value = 'basic'; modelRef.value = {} as Log; - get(model.timeStamp).then((res) => { + get(model.fields.id).then((res) => { modelRef.value = res; }); }); diff --git a/apps/vue/src/views/sys/logging/components/LoggingTable.vue b/apps/vue/src/views/sys/logging/components/LoggingTable.vue index 7944f5b6a..d2108d83c 100644 --- a/apps/vue/src/views/sys/logging/components/LoggingTable.vue +++ b/apps/vue/src/views/sys/logging/components/LoggingTable.vue @@ -41,7 +41,7 @@ const { L } = useLocalization('AbpAuditLogging'); const [registerModal, { openModal }] = useModal(); const [registerTable] = useTable({ - rowKey: 'timeStamp', + rowKey: 'fields.id', title: L('Logging'), columns: getDataColumns(), api: getList, diff --git a/aspnet-core/LINGYUN.MicroService.All.sln b/aspnet-core/LINGYUN.MicroService.All.sln index be65d756e..bc28da9f3 100644 --- a/aspnet-core/LINGYUN.MicroService.All.sln +++ b/aspnet-core/LINGYUN.MicroService.All.sln @@ -363,6 +363,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.Abp.DataProtection.EntityFrameworkCore", "modules\data-protection\LINGYUN.Abp.DataProtection.EntityFrameworkCore\LINGYUN.Abp.DataProtection.EntityFrameworkCore.csproj", "{19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.IdGenerator", "modules\common\LINGYUN.Abp.IdGenerator\LINGYUN.Abp.IdGenerator.csproj", "{440C9BD9-85EA-4473-AB1C-7C3562DF4915}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.Abp.Serilog.Enrichers.UniqueId", "modules\logging\LINGYUN.Abp.Serilog.Enrichers.UniqueId\LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj", "{23C3B247-523A-4FBF-B785-2F035E0089BD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -941,6 +945,14 @@ Global {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Debug|Any CPU.Build.0 = Debug|Any CPU {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Release|Any CPU.ActiveCfg = Release|Any CPU {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D}.Release|Any CPU.Build.0 = Release|Any CPU + {440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Debug|Any CPU.Build.0 = Debug|Any CPU + {440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Release|Any CPU.ActiveCfg = Release|Any CPU + {440C9BD9-85EA-4473-AB1C-7C3562DF4915}.Release|Any CPU.Build.0 = Release|Any CPU + {23C3B247-523A-4FBF-B785-2F035E0089BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {23C3B247-523A-4FBF-B785-2F035E0089BD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {23C3B247-523A-4FBF-B785-2F035E0089BD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {23C3B247-523A-4FBF-B785-2F035E0089BD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1120,6 +1132,8 @@ Global {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} = {C5CAD011-DF84-4914-939C-0C029DCEF26F} {BB840DEE-1F5F-45AA-A82F-4E7B7DC4F156} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} {19B860CA-2E1E-45CC-A5E2-ED3F2BCEAB5D} = {529DF802-97C4-4BF2-BE7C-39663B3D9EA3} + {440C9BD9-85EA-4473-AB1C-7C3562DF4915} = {8AC72641-30D3-4ACF-89FA-808FADC55C2E} + {23C3B247-523A-4FBF-B785-2F035E0089BD} = {6FC0578B-CDF1-43AD-9F7E-4AA7E4720A02} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {C95FDF91-16F2-4A8B-A4BE-0E62D1B66718} diff --git a/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs b/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs index f8ae32e81..89e163a61 100644 --- a/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs +++ b/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchAuditLogManager.cs @@ -242,51 +242,51 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch if (startTime.HasValue) { - querys.Add((log) => log.DateRange((q) => q.Field(f => f.ExecutionTime).GreaterThanOrEquals(startTime))); + querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(AuditLog.ExecutionTime))).GreaterThanOrEquals(startTime))); } if (endTime.HasValue) { - querys.Add((log) => log.DateRange((q) => q.Field(f => f.ExecutionTime).LessThanOrEquals(endTime))); + querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(AuditLog.ExecutionTime))).LessThanOrEquals(endTime))); } if (!httpMethod.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.HttpMethod.Suffix("keyword")).Value(httpMethod))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.HttpMethod))).Value(httpMethod))); } if (!url.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Match((q) => q.Field(f => f.Url.Suffix("keyword")).Query(url))); + querys.Add((log) => log.Match((q) => q.Field(GetField(nameof(AuditLog.Url))).Query(url))); } if (userId.HasValue) { - querys.Add((log) => log.Term((q) => q.Field(f => f.UserId.Suffix("keyword")).Value(userId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.UserId))).Value(userId))); } if (!userName.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.UserName.Suffix("keyword")).Value(userName))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.UserName))).Value(userName))); } if (!applicationName.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.ApplicationName.Suffix("keyword")).Value(applicationName))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.ApplicationName))).Value(applicationName))); } if (!correlationId.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.CorrelationId.Suffix("keyword")).Value(correlationId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.CorrelationId))).Value(correlationId))); } if (!clientId.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.ClientId.Suffix("keyword")).Value(clientId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.ClientId))).Value(clientId))); } if (!clientIpAddress.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.ClientIpAddress.Suffix("keyword")).Value(clientIpAddress))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.ClientIpAddress))).Value(clientIpAddress))); } if (maxExecutionDuration.HasValue) { - querys.Add((log) => log.Range((q) => q.Field(f => f.ExecutionDuration).LessThanOrEquals(maxExecutionDuration))); + querys.Add((log) => log.Range((q) => q.Field(GetField(nameof(AuditLog.ExecutionDuration))).LessThanOrEquals(maxExecutionDuration))); } if (minExecutionDuration.HasValue) { - querys.Add((log) => log.Range((q) => q.Field(f => f.ExecutionDuration).GreaterThanOrEquals(minExecutionDuration))); + querys.Add((log) => log.Range((q) => q.Field(GetField(nameof(AuditLog.ExecutionDuration))).GreaterThanOrEquals(minExecutionDuration))); } @@ -317,7 +317,7 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch if (httpStatusCode.HasValue) { - querys.Add((log) => log.Term((q) => q.Field(f => f.HttpStatusCode).Value(httpStatusCode))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(AuditLog.HttpStatusCode))).Value(httpStatusCode))); } return querys; @@ -344,7 +344,10 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch { "CorrelationId", "CorrelationId.keyword" }, { "BrowserInfo", "BrowserInfo.keyword" }, { "HttpMethod", "HttpMethod.keyword" }, - { "Url", "Url.keyword" } + { "Url", "Url.keyword" }, + { "ExecutionDuration", "ExecutionDuration" }, + { "ExecutionTime", "ExecutionTime" }, + { "HttpStatusCode", "HttpStatusCode" }, }; protected virtual string GetField(string field) { diff --git a/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs b/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs index 3905014ec..e8d00bb36 100644 --- a/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs +++ b/aspnet-core/modules/auditing/LINGYUN.Abp.AuditLogging.Elasticsearch/LINGYUN/Abp/AuditLogging/Elasticsearch/ElasticsearchSecurityLogManager.cs @@ -192,43 +192,43 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch if (startTime.HasValue) { - querys.Add((log) => log.DateRange((q) => q.Field(f => f.CreationTime).GreaterThanOrEquals(startTime))); + querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SecurityLog.CreationTime))).GreaterThanOrEquals(startTime))); } if (endTime.HasValue) { - querys.Add((log) => log.DateRange((q) => q.Field(f => f.CreationTime).LessThanOrEquals(endTime))); + querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SecurityLog.CreationTime))).LessThanOrEquals(endTime))); } if (!applicationName.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.ApplicationName.Suffix("keyword")).Value(applicationName))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.ApplicationName))).Value(applicationName))); } if (!identity.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Identity.Suffix("keyword")).Value(identity))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.Identity))).Value(identity))); } if (!action.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Action.Suffix("keyword")).Value(action))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.Action))).Value(action))); } if (userId.HasValue) { - querys.Add((log) => log.Term((q) => q.Field(f => f.UserId.Suffix("keyword")).Value(userId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.UserId))).Value(userId))); } if (!userName.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.UserName.Suffix("keyword")).Value(userName))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.UserName))).Value(userName))); } if (!clientId.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.ClientId.Suffix("keyword")).Value(clientId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.ClientId))).Value(clientId))); } if (!clientIpAddress.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.ClientIpAddress.Suffix("keyword")).Value(clientIpAddress))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.ClientIpAddress))).Value(clientIpAddress))); } if (!correlationId.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.CorrelationId.Suffix("keyword")).Value(correlationId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SecurityLog.CorrelationId))).Value(correlationId))); } return querys; @@ -253,6 +253,7 @@ namespace LINGYUN.Abp.AuditLogging.Elasticsearch { "ClientIpAddress", "ClientIpAddress.keyword" }, { "ClientId", "ClientId.keyword" }, { "CorrelationId", "CorrelationId.keyword" }, + { "CreationTime", "CreationTime" }, }; protected virtual string GetField(string field) { diff --git a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application.Contracts/LINGYUN/Abp/Auditing/Logging/Dto/LogFieldDto.cs b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application.Contracts/LINGYUN/Abp/Auditing/Logging/Dto/LogFieldDto.cs index 24529f75a..b18b30d9f 100644 --- a/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application.Contracts/LINGYUN/Abp/Auditing/Logging/Dto/LogFieldDto.cs +++ b/aspnet-core/modules/auditing/LINGYUN.Abp.Auditing.Application.Contracts/LINGYUN/Abp/Auditing/Logging/Dto/LogFieldDto.cs @@ -2,6 +2,7 @@ { public class LogFieldDto { + public string Id { get; set; } public string MachineName { get; set; } public string Environment { get; set; } public string Application { get; set; } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs index ac9e07167..8a574e615 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM.SignalR/LINGYUN/Abp/IM/SignalR/Hubs/MessagesHub.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.IM.Contract; +using LINGYUN.Abp.IdGenerator; +using LINGYUN.Abp.IM.Contract; using LINGYUN.Abp.IM.Groups; using LINGYUN.Abp.IM.Localization; using LINGYUN.Abp.IM.Messages; @@ -28,7 +29,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs protected IUserOnlineChanger OnlineChanger => LazyServiceProvider.LazyGetService(); - protected ISnowflakeIdrGenerator SnowflakeIdrGenerator => LazyServiceProvider.LazyGetRequiredService(); + protected IDistributedIdGenerator DistributedIdGenerator => LazyServiceProvider.LazyGetRequiredService(); protected IExceptionToErrorInfoConverter ErrorInfoConverter => LazyServiceProvider.LazyGetRequiredService(); @@ -147,7 +148,7 @@ namespace LINGYUN.Abp.IM.SignalR.Hubs try { chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous); - chatMessage.MessageId = SnowflakeIdrGenerator.Create().ToString(); + chatMessage.MessageId = DistributedIdGenerator.Create().ToString(); await MessageStore.StoreMessageAsync(chatMessage); if (!chatMessage.GroupId.IsNullOrWhiteSpace()) diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj index 271ccdc54..a65058fd2 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN.Abp.IM.csproj @@ -1,4 +1,4 @@ - + @@ -22,6 +22,7 @@ + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs index e36420f02..c97cd5dd6 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/AbpIMModule.cs @@ -1,5 +1,6 @@ using LINGYUN.Abp.IM.Localization; using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.IdGenerator; using Volo.Abp.EventBus; using Volo.Abp.Localization; using Volo.Abp.Modularity; @@ -10,7 +11,8 @@ namespace LINGYUN.Abp.IM [DependsOn( typeof(AbpEventBusModule), typeof(AbpRealTimeModule), - typeof(AbpLocalizationModule))] + typeof(AbpLocalizationModule), + typeof(AbpIdGeneratorModule))] public class AbpIMModule : AbpModule { public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs index cfc0c1e23..9a941ace6 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IM/LINGYUN/Abp/IM/Messages/MessageSender.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.IdGenerator; +using LINGYUN.Abp.RealTime; using System.Threading.Tasks; using Volo.Abp.Data; using Volo.Abp.DependencyInjection; @@ -9,19 +10,19 @@ namespace LINGYUN.Abp.IM.Messages public class MessageSender : IMessageSender, ITransientDependency { protected IDistributedEventBus EventBus { get; } - protected ISnowflakeIdrGenerator SnowflakeIdrGenerator { get; } + protected IDistributedIdGenerator DistributedIdGenerator { get; } public MessageSender( IDistributedEventBus eventBus, - ISnowflakeIdrGenerator snowflakeIdrGenerator) + IDistributedIdGenerator distributedIdGenerator) { EventBus = eventBus; - SnowflakeIdrGenerator = snowflakeIdrGenerator; + DistributedIdGenerator = distributedIdGenerator; } public virtual async Task SendMessageAsync(ChatMessage chatMessage) { chatMessage.SetProperty(nameof(ChatMessage.IsAnonymous), chatMessage.IsAnonymous); - chatMessage.MessageId = SnowflakeIdrGenerator.Create().ToString(); + chatMessage.MessageId = DistributedIdGenerator.Create().ToString(); // 如果先存储的话,就紧耦合消息处理模块了 // await Store.StoreMessageAsync(chatMessage); var eto = new RealTimeEto(chatMessage); diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xml b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xsd b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj new file mode 100644 index 000000000..a96345896 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN.Abp.IdGenerator.csproj @@ -0,0 +1,15 @@ + + + + + + + netstandard2.0 + + + + + + + + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/AbpIdGeneratorModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/AbpIdGeneratorModule.cs new file mode 100644 index 000000000..f1cb7e872 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/AbpIdGeneratorModule.cs @@ -0,0 +1,17 @@ +using LINGYUN.Abp.IdGenerator.Snowflake; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.DependencyInjection.Extensions; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.IdGenerator; + +public class AbpIdGeneratorModule : AbpModule +{ + public override void ConfigureServices(ServiceConfigurationContext context) + { + var snowflakeIdOptions = new SnowflakeIdOptions(); + context.Services.ExecutePreConfiguredActions(snowflakeIdOptions); + + context.Services.TryAddSingleton(SnowflakeIdGenerator.Create(snowflakeIdOptions)); + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/IDistributedIdGenerator.cs b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/IDistributedIdGenerator.cs new file mode 100644 index 000000000..8329de385 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/IDistributedIdGenerator.cs @@ -0,0 +1,6 @@ +namespace LINGYUN.Abp.IdGenerator; + +public interface IDistributedIdGenerator +{ + long Create(); +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdrGenerator.cs b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdGenerator.cs similarity index 61% rename from aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdrGenerator.cs rename to aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdGenerator.cs index 2f9eaab9f..22f4f9f7b 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdrGenerator.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdGenerator.cs @@ -1,13 +1,11 @@ -using Microsoft.Extensions.Options; -using System; +using System; using Volo.Abp; -using Volo.Abp.DependencyInjection; -namespace LINGYUN.Abp.RealTime +namespace LINGYUN.Abp.IdGenerator.Snowflake { // reference: https://github.com/dotnetcore/CAP // reference: https://blog.csdn.net/lq18050010830/article/details/89845790 - public class SnowflakeIdrGenerator : ISnowflakeIdrGenerator, ISingletonDependency + public class SnowflakeIdGenerator : IDistributedIdGenerator { public const long Twepoch = 1288834974657L; @@ -22,48 +20,48 @@ namespace LINGYUN.Abp.RealTime protected int TimestampLeftShift { get; } protected long SequenceMask { get; } - protected SnowflakeIdOptions Options { get; } - - public SnowflakeIdrGenerator(IOptions options) + private SnowflakeIdGenerator(SnowflakeIdOptions options) { - Options = options.Value; - - WorkerIdShift = Options.SequenceBits; - DatacenterIdShift = Options.SequenceBits + Options.WorkerIdBits; - TimestampLeftShift = Options.SequenceBits + Options.WorkerIdBits + Options.DatacenterIdBits; - SequenceMask = -1L ^ (-1L << Options.SequenceBits); + WorkerIdShift = options.SequenceBits; + DatacenterIdShift = options.SequenceBits + options.WorkerIdBits; + TimestampLeftShift = options.SequenceBits + options.WorkerIdBits + options.DatacenterIdBits; + SequenceMask = -1L ^ (-1L << options.SequenceBits); } - internal void Initialize(long sequence = 0L) + public static SnowflakeIdGenerator Create(SnowflakeIdOptions options) { - Sequence = sequence; - MaxWorkerId = -1L ^ (-1L << Options.WorkerIdBits); - MaxDatacenterId = -1L ^ (-1L << Options.DatacenterIdBits); + var idGenerator = new SnowflakeIdGenerator(options) + { + Sequence = options.Sequence, + MaxWorkerId = -1L ^ (-1L << options.WorkerIdBits), + MaxDatacenterId = -1L ^ (-1L << options.DatacenterIdBits) + }; if (!int.TryParse(Environment.GetEnvironmentVariable("WORKERID", EnvironmentVariableTarget.Machine), out var workerId)) { - workerId = RandomHelper.GetRandom((int)MaxWorkerId); + workerId = RandomHelper.GetRandom((int)idGenerator.MaxWorkerId); } if (!int.TryParse(Environment.GetEnvironmentVariable("DATACENTERID", EnvironmentVariableTarget.Machine), out var datacenterId)) { - datacenterId = RandomHelper.GetRandom((int)MaxDatacenterId); + datacenterId = RandomHelper.GetRandom((int)idGenerator.MaxDatacenterId); } - if (workerId > MaxWorkerId || workerId < 0) - throw new ArgumentException($"worker Id can't be greater than {MaxWorkerId} or less than 0"); + if (workerId > idGenerator.MaxWorkerId || workerId < 0) + throw new ArgumentException($"worker Id can't be greater than {idGenerator.MaxWorkerId} or less than 0"); - if (datacenterId > MaxDatacenterId || datacenterId < 0) - throw new ArgumentException($"datacenter Id can't be greater than {MaxDatacenterId} or less than 0"); + if (datacenterId > idGenerator.MaxDatacenterId || datacenterId < 0) + throw new ArgumentException($"datacenter Id can't be greater than {idGenerator.MaxDatacenterId} or less than 0"); + + idGenerator.WorkerId = workerId; + idGenerator.DatacenterId = datacenterId; - WorkerId = workerId; - DatacenterId = datacenterId; - + return idGenerator; } - public long WorkerId { get; protected set; } - public long DatacenterId { get; protected set; } - public long Sequence { get; protected set; } + public long WorkerId { get; internal set; } + public long DatacenterId { get; internal set; } + public long Sequence { get; internal set; } public virtual long Create() { diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdOptions.cs b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdOptions.cs new file mode 100644 index 000000000..06b884c97 --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdGenerator/LINGYUN/Abp/IdGenerator/Snowflake/SnowflakeIdOptions.cs @@ -0,0 +1,29 @@ +namespace LINGYUN.Abp.IdGenerator.Snowflake; + +public class SnowflakeIdOptions +{ + /// + /// 机器Id长度 + /// + public int WorkerIdBits { get; set; } + /// + /// 机房Id长度 + /// + public int DatacenterIdBits { get; set; } + /// + /// 12bit 的序号 + /// + public long Sequence { get; set; } + /// + /// 每秒生成Id的数量 + /// + public int SequenceBits { get; set; } + + public SnowflakeIdOptions() + { + WorkerIdBits = 5; + DatacenterIdBits = 5; + Sequence = 0L; + SequenceBits = 12; + } +} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj index 01eea5617..063bb437d 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN.Abp.Notifications.csproj @@ -1,4 +1,4 @@ - + @@ -16,6 +16,7 @@ + diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs index 2b210fe05..e5c92e07c 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/AbpNotificationModule.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.Notifications.Internal; +using LINGYUN.Abp.IdGenerator; +using LINGYUN.Abp.Notifications.Internal; using LINGYUN.Abp.RealTime; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; @@ -16,6 +17,7 @@ namespace LINGYUN.Abp.Notifications [DependsOn( typeof(AbpBackgroundWorkersModule), typeof(AbpBackgroundJobsAbstractionsModule), + typeof(AbpIdGeneratorModule), typeof(AbpJsonModule), typeof(AbpRealTimeModule))] public class AbpNotificationModule : AbpModule diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs index cc5e55902..365b018e4 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/NotificationSender.cs @@ -1,4 +1,5 @@ -using LINGYUN.Abp.RealTime; +using LINGYUN.Abp.IdGenerator; +using LINGYUN.Abp.RealTime; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; @@ -26,19 +27,19 @@ namespace LINGYUN.Abp.Notifications /// public IDistributedEventBus DistributedEventBus { get; } /// - /// Reference to . + /// Reference to . /// - protected ISnowflakeIdrGenerator SnowflakeIdGenerator { get; } + protected IDistributedIdGenerator DistributedIdGenerator { get; } protected AbpNotificationOptions Options { get; } public NotificationSender( IDistributedEventBus distributedEventBus, - ISnowflakeIdrGenerator snowflakeIdrGenerator, + IDistributedIdGenerator distributedIdGenerator, IOptions options) { Options = options.Value; DistributedEventBus = distributedEventBus; - SnowflakeIdGenerator = snowflakeIdrGenerator; + DistributedIdGenerator = distributedIdGenerator; Logger = NullLogger.Instance; } @@ -79,7 +80,7 @@ namespace LINGYUN.Abp.Notifications { var eto = new NotificationEto(data) { - Id = SnowflakeIdGenerator.Create(), + Id = DistributedIdGenerator.Create(), TenantId = tenantId, Users = users?.ToList(), Name = name, diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/AbpRealTimeModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/AbpRealTimeModule.cs index 4eb61246e..7407dc6a3 100644 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/AbpRealTimeModule.cs +++ b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/AbpRealTimeModule.cs @@ -1,6 +1,4 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp; -using Volo.Abp.EventBus.Abstractions; +using Volo.Abp.EventBus.Abstractions; using Volo.Abp.Modularity; namespace LINGYUN.Abp.RealTime @@ -8,12 +6,5 @@ namespace LINGYUN.Abp.RealTime [DependsOn(typeof(AbpEventBusAbstractionsModule))] public class AbpRealTimeModule : AbpModule { - public override void OnApplicationInitialization(ApplicationInitializationContext context) - { - context - .ServiceProvider - .GetRequiredService() - .Initialize(); - } } } diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/ISnowflakeIdrGenerator.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/ISnowflakeIdrGenerator.cs deleted file mode 100644 index bc982928c..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/ISnowflakeIdrGenerator.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace LINGYUN.Abp.RealTime -{ - public interface ISnowflakeIdrGenerator - { - long Create(); - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdOptions.cs b/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdOptions.cs deleted file mode 100644 index 62a63c53d..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.RealTime/LINGYUN/Abp/RealTime/SnowflakeIdOptions.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace LINGYUN.Abp.RealTime -{ - public class SnowflakeIdOptions - { - /// - /// 机器Id长度 - /// - public int WorkerIdBits { get; set; } - /// - /// 机房Id长度 - /// - public int DatacenterIdBits { get; set; } - /// - /// 每秒生成Id的数量 - /// - public int SequenceBits { get; set; } - public SnowflakeIdOptions() - { - WorkerIdBits = 5; - DatacenterIdBits = 5; - SequenceBits = 12; - } - } -} diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj index 52b55c9cd..a83999859 100644 --- a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN.Abp.Logging.Serilog.Elasticsearch.csproj @@ -18,6 +18,7 @@ + diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs index 73aa97176..8d1560626 100644 --- a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/AbpLoggingSerilogElasticsearchMapperProfile.cs @@ -7,7 +7,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch public AbpLoggingSerilogElasticsearchMapperProfile() { CreateMap(); - CreateMap(); + CreateMap() + .ForMember(log => log.Id, map => map.MapFrom(slog => slog.UniqueId.ToString())); CreateMap(); } } diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogElasticsearchLoggingManager.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogElasticsearchLoggingManager.cs index 56a16eaa6..44fad6311 100644 --- a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogElasticsearchLoggingManager.cs +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogElasticsearchLoggingManager.cs @@ -1,5 +1,6 @@ using LINGYUN.Abp.Elasticsearch; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; @@ -71,8 +72,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch }, { "term": { - "@timestamp": { - "value": "2021-10-31T09:53:12.3406273+08:00" + "fields.UniqueId": { + "value": "1474021081433481216" } } } @@ -87,9 +88,9 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch (q) => q.Bool( (b) => b.Must( (s) => s.Term( - (t) => t.Field("@timestamp").Value(id)), + (t) => t.Field(GetField(nameof(SerilogInfo.Fields.UniqueId))).Value(id)), (s) => s.Term( - (t) => t.Field(f => f.Fields.TenantId.Suffix("keyword")).Value(_currentTenant.GetId()))))), + (t) => t.Field(GetField(nameof(SerilogInfo.Fields.TenantId))).Value(_currentTenant.GetId()))))), cancellationToken); } else @@ -100,8 +101,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch "must": [ { "term": { - "@timestamp": { - "value": "2021-10-31T09:53:12.3406273+08:00" + "fields.UniqueId": { + "value": "1474021081433481216" } } } @@ -116,7 +117,7 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch (q) => q.Bool( (b) => b.Must( (s) => s.Term( - (t) => t.Field("@timestamp").Value(id))))), + (t) => t.Field(GetField(nameof(SerilogInfo.Fields.UniqueId))).Value(id))))), cancellationToken); } @@ -210,7 +211,9 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch var sortOrder = !sorting.IsNullOrWhiteSpace() && sorting.EndsWith("asc", StringComparison.InvariantCultureIgnoreCase) ? SortOrder.Ascending : SortOrder.Descending; - sorting = sorting ?? "timestamp"; + sorting = !sorting.IsNullOrWhiteSpace() + ? sorting.Split()[0] + : nameof(SerilogInfo.TimeStamp); var querys = BuildQueryDescriptor( startTime, @@ -241,7 +244,9 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch var response = await client.SearchAsync((dsl) => dsl.Index(CreateIndex()) - .Query(log => log.Bool(b => b.Must(querys.ToArray()))) + .Query(log => + log.Bool(b => + b.Must(querys.ToArray()))) .Source(SourceFilter) .Sort(log => log.Field(GetField(sorting), sortOrder)) .From(skipCount) @@ -270,55 +275,56 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch if (_currentTenant.IsAvailable) { - querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.TenantId.Suffix("keyword")).Value(_currentTenant.GetId()))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.TenantId))).Value(_currentTenant.GetId()))); } if (startTime.HasValue) { - querys.Add((log) => log.DateRange((q) => q.Field(f => f.TimeStamp).GreaterThanOrEquals(startTime))); + querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SerilogInfo.TimeStamp))).GreaterThanOrEquals(startTime))); } if (endTime.HasValue) { - querys.Add((log) => log.DateRange((q) => q.Field(f => f.TimeStamp).LessThanOrEquals(endTime))); + querys.Add((log) => log.DateRange((q) => q.Field(GetField(nameof(SerilogInfo.TimeStamp))).LessThanOrEquals(endTime))); } if (level.HasValue) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Level.Suffix("keyword")).Value(level.ToString()))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Level))).Value(level.ToString()))); } if (!machineName.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.MachineName.Suffix("keyword")).Value(machineName))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.MachineName))).Value(machineName))); } if (!environment.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.Environment.Suffix("keyword")).Value(environment))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.Environment))).Value(environment))); } if (!application.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.Application.Suffix("keyword")).Value(application))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.Application))).Value(application))); } if (!context.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field((f) => f.Fields.Context.Suffix("keyword")).Value(context))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.Context))).Value(context))); } if (!requestId.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Match((q) => q.Field(f => f.Fields.RequestId.Suffix("keyword")).Query(requestId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.RequestId))).Value(requestId))); } if (!requestPath.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.RequestPath.Suffix("keyword")).Value(requestPath))); + // 模糊匹配 + querys.Add((log) => log.MatchPhrasePrefix((q) => q.Field(f => f.Fields.RequestPath).Query(requestPath))); } if (!correlationId.IsNullOrWhiteSpace()) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.CorrelationId.Suffix("keyword")).Value(correlationId))); + querys.Add((log) => log.MatchPhrase((q) => q.Field(GetField(nameof(SerilogInfo.Fields.CorrelationId))).Query(correlationId))); } if (processId.HasValue) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.ProcessId).Value(processId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.ProcessId))).Value(processId))); } if (threadId.HasValue) { - querys.Add((log) => log.Term((q) => q.Field(f => f.Fields.ThreadId).Value(threadId))); + querys.Add((log) => log.Term((q) => q.Field(GetField(nameof(SerilogInfo.Fields.ThreadId))).Value(threadId))); } if (hasException.HasValue) @@ -386,6 +392,8 @@ namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch { "userid", "fields.UserId.keyword" }, { "processid", "fields.ProcessId" }, { "threadid", "fields.ThreadId" }, + { "id", $"fields.{AbpSerilogUniqueIdConsts.UniqueIdPropertyName}" }, + { "uniqueid", $"fields.{AbpSerilogUniqueIdConsts.UniqueIdPropertyName}" }, }; protected virtual string GetField(string field) { diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogField.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogField.cs index 7409aab49..0ef275557 100644 --- a/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogField.cs +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Logging.Serilog.Elasticsearch/LINGYUN/Abp/AuditLogging/Serilog/Elasticsearch/SerilogField.cs @@ -1,10 +1,14 @@ using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using System; namespace LINGYUN.Abp.Logging.Serilog.Elasticsearch { public class SerilogField { + [Nest.PropertyName(AbpSerilogUniqueIdConsts.UniqueIdPropertyName)] + public long UniqueId { get; set; } + [Nest.PropertyName(AbpLoggingEnricherPropertyNames.MachineName)] public string MachineName { get; set; } diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Logging/LINGYUN/Abp/AuditLogging/LogField.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Logging/LINGYUN/Abp/AuditLogging/LogField.cs index a91996afb..11c296850 100644 --- a/aspnet-core/modules/logging/LINGYUN.Abp.Logging/LINGYUN/Abp/AuditLogging/LogField.cs +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Logging/LINGYUN/Abp/AuditLogging/LogField.cs @@ -2,6 +2,7 @@ { public class LogField { + public string Id { get; set; } public string MachineName { get; set; } public string Environment { get; set; } public string Application { get; set; } diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xml b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xml new file mode 100644 index 000000000..ac6b5b292 --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xsd b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xsd new file mode 100644 index 000000000..11da52550 --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/FodyWeavers.xsd @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj new file mode 100644 index 000000000..3aa276e15 --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN.Abp.Serilog.Enrichers.UniqueId.csproj @@ -0,0 +1,19 @@ + + + + + + + netstandard2.0 + + + + + + + + + + + + diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogEnrichersUniqueIdModule.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogEnrichersUniqueIdModule.cs new file mode 100644 index 000000000..b287d5417 --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogEnrichersUniqueIdModule.cs @@ -0,0 +1,10 @@ +using LINGYUN.Abp.IdGenerator; +using Volo.Abp.Modularity; + +namespace LINGYUN.Abp.Serilog.Enrichers.UniqueId +{ + [DependsOn(typeof(AbpIdGeneratorModule))] + public class AbpSerilogEnrichersUniqueIdModule : AbpModule + { + } +} diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogUniqueIdConsts.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogUniqueIdConsts.cs new file mode 100644 index 000000000..7fa11d802 --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/AbpSerilogUniqueIdConsts.cs @@ -0,0 +1,7 @@ +namespace LINGYUN.Abp.Serilog.Enrichers.UniqueId +{ + public class AbpSerilogUniqueIdConsts + { + public const string UniqueIdPropertyName = "UniqueId"; + } +} diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/UniqueIdEnricher.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/UniqueIdEnricher.cs new file mode 100644 index 000000000..82d66954b --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/LINGYUN/Abp/Serilog/Enrichers/UniqueId/UniqueIdEnricher.cs @@ -0,0 +1,21 @@ +using LINGYUN.Abp.IdGenerator; +using LINGYUN.Abp.IdGenerator.Snowflake; +using Serilog.Core; +using Serilog.Events; + +namespace LINGYUN.Abp.Serilog.Enrichers.UniqueId +{ + public class UniqueIdEnricher : ILogEventEnricher + { + private readonly static IDistributedIdGenerator _distributedIdGenerator + = SnowflakeIdGenerator.Create(new SnowflakeIdOptions()); + + public void Enrich(LogEvent logEvent, ILogEventPropertyFactory propertyFactory) + { + logEvent.AddOrUpdateProperty( + propertyFactory.CreateProperty( + AbpSerilogUniqueIdConsts.UniqueIdPropertyName, + _distributedIdGenerator.Create())); + } + } +} diff --git a/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/Serilog/UniqueIdLoggerConfigurationExtensions.cs b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/Serilog/UniqueIdLoggerConfigurationExtensions.cs new file mode 100644 index 000000000..91f4b73ed --- /dev/null +++ b/aspnet-core/modules/logging/LINGYUN.Abp.Serilog.Enrichers.UniqueId/Serilog/UniqueIdLoggerConfigurationExtensions.cs @@ -0,0 +1,16 @@ +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; +using Serilog.Configuration; +using System; + +namespace Serilog +{ + public static class UniqueIdLoggerConfigurationExtensions + { + public static LoggerConfiguration WithUniqueId( + this LoggerEnrichmentConfiguration enrichmentConfiguration) + { + if (enrichmentConfiguration == null) throw new ArgumentNullException(nameof(enrichmentConfiguration)); + return enrichmentConfiguration.With(); + } + } +} diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs index 3587c1928..0f6d28ea6 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/BackendAdminHttpApiHostModule.cs @@ -11,6 +11,7 @@ using LINGYUN.Abp.Logging.Serilog.Elasticsearch; using LINGYUN.Abp.MultiTenancy.DbFinder; using LINGYUN.Abp.PermissionManagement.Identity; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.SettingManagement; using LINGYUN.Abp.Sms.Aliyun; using LINGYUN.Abp.TenantManagement; @@ -40,43 +41,44 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace LY.MicroService.BackendAdmin; [DependsOn( - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpLoggingSerilogElasticsearchModule), - typeof(AbpAuditLoggingElasticsearchModule), - typeof(AbpAspNetCoreMvcUiMultiTenancyModule), - typeof(AbpSettingManagementApplicationModule), - typeof(AbpSettingManagementHttpApiModule), - typeof(AbpPermissionManagementApplicationModule), - typeof(AbpPermissionManagementHttpApiModule), - typeof(AbpFeatureManagementApplicationModule), - typeof(AbpFeatureManagementHttpApiModule), - typeof(AbpFeatureManagementClientModule), - typeof(AbpAuditingApplicationModule), - typeof(AbpAuditingHttpApiModule), - typeof(AbpTenantManagementApplicationModule), - typeof(AbpTenantManagementHttpApiModule), - typeof(AbpEntityFrameworkCoreMySQLModule), - typeof(AbpIdentityEntityFrameworkCoreModule),// 用户角色权限需要引用包 - typeof(AbpIdentityServerEntityFrameworkCoreModule), // 客户端权限需要引用包 - typeof(AbpTenantManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpPermissionManagementDomainIdentityModule), - typeof(AbpPermissionManagementDomainIdentityServerModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpFeatureManagementEntityFrameworkCoreModule), - typeof(AbpLocalizationManagementEntityFrameworkCoreModule), - typeof(AbpDataDbMigratorModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpEmailingExceptionHandlingModule), - typeof(AbpCAPEventBusModule), - typeof(AbpAliyunSmsModule), - typeof(AbpDbFinderMultiTenancyModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpAspNetCoreHttpOverridesModule), - typeof(AbpLocalizationCultureMapModule), - typeof(AbpAutofacModule) - )] + typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpLoggingSerilogElasticsearchModule), + typeof(AbpAuditLoggingElasticsearchModule), + typeof(AbpAspNetCoreMvcUiMultiTenancyModule), + typeof(AbpSettingManagementApplicationModule), + typeof(AbpSettingManagementHttpApiModule), + typeof(AbpPermissionManagementApplicationModule), + typeof(AbpPermissionManagementHttpApiModule), + typeof(AbpFeatureManagementApplicationModule), + typeof(AbpFeatureManagementHttpApiModule), + typeof(AbpFeatureManagementClientModule), + typeof(AbpAuditingApplicationModule), + typeof(AbpAuditingHttpApiModule), + typeof(AbpTenantManagementApplicationModule), + typeof(AbpTenantManagementHttpApiModule), + typeof(AbpEntityFrameworkCoreMySQLModule), + typeof(AbpIdentityEntityFrameworkCoreModule),// 用户角色权限需要引用包 + typeof(AbpIdentityServerEntityFrameworkCoreModule), // 客户端权限需要引用包 + typeof(AbpTenantManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpPermissionManagementDomainIdentityModule), + typeof(AbpPermissionManagementDomainIdentityServerModule), + typeof(AbpPermissionManagementEntityFrameworkCoreModule), + typeof(AbpFeatureManagementEntityFrameworkCoreModule), + typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpDataDbMigratorModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpEmailingExceptionHandlingModule), + typeof(AbpCAPEventBusModule), + typeof(AbpAliyunSmsModule), + typeof(AbpDbFinderMultiTenancyModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpAspNetCoreHttpOverridesModule), + typeof(AbpLocalizationCultureMapModule), + typeof(AbpAutofacModule) + )] public partial class BackendAdminHttpApiHostModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) @@ -89,8 +91,9 @@ public partial class BackendAdminHttpApiHostModule : AbpModule public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAlwaysAllowAuthorization(); var hostingEnvironment = context.Services.GetHostingEnvironment(); - var configuration = hostingEnvironment.BuildConfiguration(); + var configuration = context.Services.GetConfiguration(); ConfigureDbContext(); ConfigureJsonSerializer(); diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj index 0b2d3ec3c..7290f290a 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/LY.MicroService.BackendAdmin.HttpApi.Host.csproj @@ -62,6 +62,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Properties/launchSettings.json b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Properties/launchSettings.json index ceb66ec05..731195696 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Properties/launchSettings.json +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Properties/launchSettings.json @@ -14,7 +14,7 @@ "launchBrowser": false, "applicationUrl": "http://127.0.0.1:30010", "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" + "ASPNETCORE_ENVIRONMENT": "Production" } } } diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.json b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.json index 4764de687..e113587b1 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/appsettings.json @@ -13,7 +13,7 @@ "DotNetCore": "Information" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LY.MicroService.LocalizationManagement.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LY.MicroService.LocalizationManagement.HttpApi.Host.csproj index 006beb283..8c511656f 100644 --- a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LY.MicroService.LocalizationManagement.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LY.MicroService.LocalizationManagement.HttpApi.Host.csproj @@ -43,6 +43,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.cs index ca8746d48..87fb2f456 100644 --- a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/LocalizationManagementHttpApiHostModule.cs @@ -8,6 +8,7 @@ using LINGYUN.Abp.LocalizationManagement; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.MultiTenancy.DbFinder; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -27,6 +28,7 @@ namespace LY.MicroService.LocalizationManagement { [DependsOn( typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpAspNetCoreMultiTenancyModule), diff --git a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.json b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.json index 28721ef2f..7d29039dd 100644 --- a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/appsettings.json @@ -15,7 +15,7 @@ "DotNetCore": "Information" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/LY.MicroService.PlatformManagement.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/LY.MicroService.PlatformManagement.HttpApi.Host.csproj index b5a52dac5..ecbd725a0 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/LY.MicroService.PlatformManagement.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/LY.MicroService.PlatformManagement.HttpApi.Host.csproj @@ -50,6 +50,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs index d24c943ad..2be103608 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/PlatformManagementHttpApiHostModule.cs @@ -13,6 +13,7 @@ using LINGYUN.Abp.OssManagement.FileSystem; using LINGYUN.Abp.OssManagement.FileSystem.ImageSharp; using LINGYUN.Abp.OssManagement.SettingManagement; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.UI.Navigation.VueVbenAdmin; using LINGYUN.Platform; using LINGYUN.Platform.EntityFrameworkCore; @@ -39,41 +40,42 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace LY.MicroService.PlatformManagement; [DependsOn( - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpAuditLoggingElasticsearchModule), - typeof(AbpAspNetCoreMultiTenancyModule), - typeof(AbpUINavigationVueVbenAdminModule), - // typeof(AbpOssManagementAliyunModule), - typeof(AbpOssManagementFileSystemModule), // 本地文件系统提供者模块 - typeof(AbpOssManagementFileSystemImageSharpModule), // 本地文件系统图形处理模块 - typeof(AbpOssManagementApplicationModule), - typeof(AbpOssManagementHttpApiModule), - typeof(AbpOssManagementSettingManagementModule), - typeof(PlatformApplicationModule), - typeof(PlatformHttpApiModule), - typeof(PlatformEntityFrameworkCoreModule), - typeof(AbpIdentityHttpApiClientModule), - typeof(AbpHttpClientIdentityModelWebModule), - typeof(AbpFeatureManagementEntityFrameworkCoreModule), - typeof(AbpTenantManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpLocalizationManagementEntityFrameworkCoreModule), - typeof(AbpDataDbMigratorModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpNotificationModule), - typeof(AbpEmailingExceptionHandlingModule), - typeof(AbpCAPEventBusModule), - typeof(AbpFeaturesValidationRedisModule), - // typeof(AbpFeaturesClientModule),// 当需要客户端特性限制时取消注释此模块 - // typeof(AbpFeaturesValidationRedisClientModule),// 当需要客户端特性限制时取消注释此模块 - typeof(AbpDbFinderMultiTenancyModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpAspNetCoreHttpOverridesModule), - typeof(AbpLocalizationCultureMapModule), - typeof(AbpAutofacModule) - )] + typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpAuditLoggingElasticsearchModule), + typeof(AbpAspNetCoreMultiTenancyModule), + typeof(AbpUINavigationVueVbenAdminModule), + // typeof(AbpOssManagementAliyunModule), + typeof(AbpOssManagementFileSystemModule), // 本地文件系统提供者模块 + typeof(AbpOssManagementFileSystemImageSharpModule), // 本地文件系统图形处理模块 + typeof(AbpOssManagementApplicationModule), + typeof(AbpOssManagementHttpApiModule), + typeof(AbpOssManagementSettingManagementModule), + typeof(PlatformApplicationModule), + typeof(PlatformHttpApiModule), + typeof(PlatformEntityFrameworkCoreModule), + typeof(AbpIdentityHttpApiClientModule), + typeof(AbpHttpClientIdentityModelWebModule), + typeof(AbpFeatureManagementEntityFrameworkCoreModule), + typeof(AbpTenantManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpPermissionManagementEntityFrameworkCoreModule), + typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpDataDbMigratorModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpNotificationModule), + typeof(AbpEmailingExceptionHandlingModule), + typeof(AbpCAPEventBusModule), + typeof(AbpFeaturesValidationRedisModule), + // typeof(AbpFeaturesClientModule),// 当需要客户端特性限制时取消注释此模块 + // typeof(AbpFeaturesValidationRedisClientModule),// 当需要客户端特性限制时取消注释此模块 + typeof(AbpDbFinderMultiTenancyModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpAspNetCoreHttpOverridesModule), + typeof(AbpLocalizationCultureMapModule), + typeof(AbpAutofacModule) + )] public partial class PlatformManagementHttpApiHostModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.json b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.json index 28721ef2f..7d29039dd 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/appsettings.json @@ -15,7 +15,7 @@ "DotNetCore": "Information" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj index 6dc01c194..1e029e6c9 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/LY.MicroService.RealtimeMessage.HttpApi.Host.csproj @@ -54,6 +54,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs index b599c80c6..e0b42684b 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/RealtimeMessageHttpApiHostModule.cs @@ -17,6 +17,7 @@ using LINGYUN.Abp.Notifications.SignalR; using LINGYUN.Abp.Notifications.Sms; using LINGYUN.Abp.Notifications.WeChat.MiniProgram; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; @@ -38,6 +39,7 @@ namespace LY.MicroService.RealtimeMessage { [DependsOn( typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), typeof(AbpAspNetCoreSerilogModule), typeof(AbpAuditLoggingElasticsearchModule), typeof(AbpAspNetCoreMultiTenancyModule), diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.json b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.json index 28721ef2f..7d29039dd 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/appsettings.json @@ -15,7 +15,7 @@ "DotNetCore": "Information" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj index d624a7ca9..9c31de879 100644 --- a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/LY.MicroService.WorkflowManagement.HttpApi.Host.csproj @@ -43,6 +43,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs index ce629ca57..647c6db9d 100644 --- a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/WorkflowManagementHttpApiHostModule.cs @@ -5,6 +5,7 @@ using LINGYUN.Abp.ExceptionHandling.Emailing; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.MultiTenancy.DbFinder; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.WorkflowCore.Components; using LINGYUN.Abp.WorkflowCore.DistributedLock; using LINGYUN.Abp.WorkflowCore.LifeCycleEvent; @@ -37,36 +38,37 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace LY.MicroService.WorkflowManagement; [DependsOn( - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpAuditLoggingElasticsearchModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpEventBusRabbitMqModule), - typeof(AbpBlobStoringOssManagementModule), - typeof(WorkflowManagementApplicationModule), - typeof(WorkflowManagementHttpApiModule), - typeof(WorkflowManagementEntityFrameworkCoreModule), - typeof(AbpWorkflowCoreComponentsModule), - typeof(AbpWorkflowCoreDistributedLockModule), - typeof(AbpWorkflowCoreLifeCycleEventModule), - typeof(AbpWorkflowCoreRabbitMQModule), - typeof(AbpWorkflowCorePersistenceEntityFrameworkCoreModule), - typeof(AbpEntityFrameworkCoreMySQLModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpEmailingExceptionHandlingModule), - typeof(AbpHttpClientIdentityModelWebModule), - typeof(AbpAspNetCoreMultiTenancyModule), - typeof(AbpDbFinderMultiTenancyModule), - typeof(AbpFeatureManagementEntityFrameworkCoreModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpTenantManagementEntityFrameworkCoreModule), - typeof(AbpLocalizationManagementEntityFrameworkCoreModule), - typeof(AbpDataDbMigratorModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpAspNetCoreMvcModule), - typeof(AbpSwashbuckleModule), - typeof(AbpAutofacModule) - )] + typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), + typeof(AbpAuditLoggingElasticsearchModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpEventBusRabbitMqModule), + typeof(AbpBlobStoringOssManagementModule), + typeof(WorkflowManagementApplicationModule), + typeof(WorkflowManagementHttpApiModule), + typeof(WorkflowManagementEntityFrameworkCoreModule), + typeof(AbpWorkflowCoreComponentsModule), + typeof(AbpWorkflowCoreDistributedLockModule), + typeof(AbpWorkflowCoreLifeCycleEventModule), + typeof(AbpWorkflowCoreRabbitMQModule), + typeof(AbpWorkflowCorePersistenceEntityFrameworkCoreModule), + typeof(AbpEntityFrameworkCoreMySQLModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpEmailingExceptionHandlingModule), + typeof(AbpHttpClientIdentityModelWebModule), + typeof(AbpAspNetCoreMultiTenancyModule), + typeof(AbpDbFinderMultiTenancyModule), + typeof(AbpFeatureManagementEntityFrameworkCoreModule), + typeof(AbpPermissionManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpTenantManagementEntityFrameworkCoreModule), + typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpDataDbMigratorModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpAspNetCoreMvcModule), + typeof(AbpSwashbuckleModule), + typeof(AbpAutofacModule) + )] public partial class WorkflowManagementHttpApiHostModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.json b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.json index 95b9dd93b..67e1bc4bd 100644 --- a/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/LY.MicroService.WorkflowManagement.HttpApi.Host/appsettings.json @@ -14,7 +14,7 @@ "Microsoft": "Information" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs index 630183659..0dee706bc 100644 --- a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs +++ b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/IdentityServerHttpApiHostModule.cs @@ -6,6 +6,7 @@ using LINGYUN.Abp.Localization.CultureMap; using LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; using LINGYUN.Abp.MultiTenancy.DbFinder; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.Sms.Aliyun; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -26,33 +27,34 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace LY.MicroService.IdentityServer; [DependsOn( - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpAspNetCoreMultiTenancyModule), - typeof(LINGYUN.Abp.Account.AbpAccountApplicationModule), - typeof(LINGYUN.Abp.Account.AbpAccountHttpApiModule), - typeof(LINGYUN.Abp.Identity.AbpIdentityApplicationModule), - typeof(LINGYUN.Abp.Identity.AbpIdentityHttpApiModule), - typeof(LINGYUN.Abp.IdentityServer.AbpIdentityServerApplicationModule), - typeof(LINGYUN.Abp.IdentityServer.AbpIdentityServerHttpApiModule), - typeof(LINGYUN.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule), - typeof(LINGYUN.Abp.IdentityServer.EntityFrameworkCore.AbpIdentityServerEntityFrameworkCoreModule), - typeof(AbpEntityFrameworkCoreMySQLModule), - typeof(AbpTenantManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpLocalizationManagementEntityFrameworkCoreModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpAuditLoggingElasticsearchModule), - typeof(AbpEmailingExceptionHandlingModule), - typeof(AbpCAPEventBusModule), - typeof(AbpAliyunSmsModule), - typeof(AbpDbFinderMultiTenancyModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpAspNetCoreHttpOverridesModule), - typeof(AbpLocalizationCultureMapModule), - typeof(AbpAutofacModule) - )] + typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpAspNetCoreMultiTenancyModule), + typeof(LINGYUN.Abp.Account.AbpAccountApplicationModule), + typeof(LINGYUN.Abp.Account.AbpAccountHttpApiModule), + typeof(LINGYUN.Abp.Identity.AbpIdentityApplicationModule), + typeof(LINGYUN.Abp.Identity.AbpIdentityHttpApiModule), + typeof(LINGYUN.Abp.IdentityServer.AbpIdentityServerApplicationModule), + typeof(LINGYUN.Abp.IdentityServer.AbpIdentityServerHttpApiModule), + typeof(LINGYUN.Abp.Identity.EntityFrameworkCore.AbpIdentityEntityFrameworkCoreModule), + typeof(LINGYUN.Abp.IdentityServer.EntityFrameworkCore.AbpIdentityServerEntityFrameworkCoreModule), + typeof(AbpEntityFrameworkCoreMySQLModule), + typeof(AbpTenantManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpPermissionManagementEntityFrameworkCoreModule), + typeof(AbpLocalizationManagementEntityFrameworkCoreModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpAuditLoggingElasticsearchModule), + typeof(AbpEmailingExceptionHandlingModule), + typeof(AbpCAPEventBusModule), + typeof(AbpAliyunSmsModule), + typeof(AbpDbFinderMultiTenancyModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpAspNetCoreHttpOverridesModule), + typeof(AbpLocalizationCultureMapModule), + typeof(AbpAutofacModule) + )] public partial class IdentityServerHttpApiHostModule : AbpModule { public override void PreConfigureServices(ServiceConfigurationContext context) diff --git a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/LY.MicroService.identityServer.HttpApi.Host.csproj b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/LY.MicroService.identityServer.HttpApi.Host.csproj index 48bf710da..fe4576d55 100644 --- a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/LY.MicroService.identityServer.HttpApi.Host.csproj +++ b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/LY.MicroService.identityServer.HttpApi.Host.csproj @@ -68,6 +68,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.json b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.json index 3be84adf2..873315f9a 100644 --- a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.json +++ b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/appsettings.json @@ -13,7 +13,7 @@ "DotNetCore": "Debug" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs b/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs index 2fe359a05..5b38aa36a 100644 --- a/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs +++ b/aspnet-core/services/LY.MicroService.identityServer/IdentityServerModule.cs @@ -10,6 +10,7 @@ using LINGYUN.Abp.Localization.CultureMap; using LINGYUN.Abp.MultiTenancy.DbFinder; using LINGYUN.Abp.PermissionManagement.Identity; using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using LINGYUN.Abp.Sms.Aliyun; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; @@ -36,34 +37,35 @@ using Volo.Abp.TenantManagement.EntityFrameworkCore; namespace LY.MicroService.IdentityServer; [DependsOn( - typeof(AbpSerilogEnrichersApplicationModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpAccountWebIdentityServerModule), - typeof(AbpAccountApplicationModule), - typeof(AbpAspNetCoreMvcUiBasicThemeModule), - typeof(AbpAutofacModule), - typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpEntityFrameworkCoreMySQLModule), - typeof(AbpIdentityEntityFrameworkCoreModule), - typeof(AbpIdentityApplicationModule), - // typeof(AbpIdentityHttpApiModule), - typeof(AbpIdentityServerEntityFrameworkCoreModule), - typeof(AbpIdentityServerSmsValidatorModule), - typeof(AbpIdentityServerWeChatModule), - typeof(AbpPermissionManagementDomainIdentityModule), - typeof(AbpPermissionManagementEntityFrameworkCoreModule), - typeof(AbpSettingManagementEntityFrameworkCoreModule), - typeof(AbpFeatureManagementEntityFrameworkCoreModule), - typeof(AbpTenantManagementEntityFrameworkCoreModule), - typeof(AbpDataDbMigratorModule), - typeof(AbpAspNetCoreAuthenticationJwtBearerModule), - typeof(AbpAuditLoggingElasticsearchModule), // 放在 AbpIdentity 模块之后,避免被覆盖 - typeof(AbpAspNetCoreHttpOverridesModule), - typeof(AbpLocalizationCultureMapModule), - typeof(AbpDbFinderMultiTenancyModule), - typeof(AbpCAPEventBusModule), - typeof(AbpAliyunSmsModule) - )] + typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), + typeof(AbpAspNetCoreSerilogModule), + typeof(AbpAccountWebIdentityServerModule), + typeof(AbpAccountApplicationModule), + typeof(AbpAspNetCoreMvcUiBasicThemeModule), + typeof(AbpAutofacModule), + typeof(AbpCachingStackExchangeRedisModule), + typeof(AbpEntityFrameworkCoreMySQLModule), + typeof(AbpIdentityEntityFrameworkCoreModule), + typeof(AbpIdentityApplicationModule), + // typeof(AbpIdentityHttpApiModule), + typeof(AbpIdentityServerEntityFrameworkCoreModule), + typeof(AbpIdentityServerSmsValidatorModule), + typeof(AbpIdentityServerWeChatModule), + typeof(AbpPermissionManagementDomainIdentityModule), + typeof(AbpPermissionManagementEntityFrameworkCoreModule), + typeof(AbpSettingManagementEntityFrameworkCoreModule), + typeof(AbpFeatureManagementEntityFrameworkCoreModule), + typeof(AbpTenantManagementEntityFrameworkCoreModule), + typeof(AbpDataDbMigratorModule), + typeof(AbpAspNetCoreAuthenticationJwtBearerModule), + typeof(AbpAuditLoggingElasticsearchModule), // 放在 AbpIdentity 模块之后,避免被覆盖 + typeof(AbpAspNetCoreHttpOverridesModule), + typeof(AbpLocalizationCultureMapModule), + typeof(AbpDbFinderMultiTenancyModule), + typeof(AbpCAPEventBusModule), + typeof(AbpAliyunSmsModule) + )] public partial class IdentityServerModule : AbpModule { private const string DefaultCorsPolicyName = "Default"; diff --git a/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj b/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj index 9743ab793..10ce6782d 100644 --- a/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj +++ b/aspnet-core/services/LY.MicroService.identityServer/LY.MicroService.IdentityServer.csproj @@ -58,6 +58,7 @@ + diff --git a/aspnet-core/services/LY.MicroService.identityServer/appsettings.json b/aspnet-core/services/LY.MicroService.identityServer/appsettings.json index 18ccb536e..61952cf75 100644 --- a/aspnet-core/services/LY.MicroService.identityServer/appsettings.json +++ b/aspnet-core/services/LY.MicroService.identityServer/appsettings.json @@ -13,7 +13,7 @@ "DotNetCore": "Information" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console", diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.sln b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.sln index 39743f748..7a8e5a763 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.sln +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.sln @@ -1,21 +1,30 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LINGYUN.MicroService.Internal.ApiGateway", "src\LINGYUN.MicroService.Internal.ApiGateway\LINGYUN.MicroService.Internal.ApiGateway.csproj", "{00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8067AED-2B6E-4134-AAF8-9101457D709A}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2} = {E8067AED-2B6E-4134-AAF8-9101457D709A} - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31919.166 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LINGYUN.MicroService.Internal.ApiGateway", "src\LINGYUN.MicroService.Internal.ApiGateway\LINGYUN.MicroService.Internal.ApiGateway.csproj", "{00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{E8067AED-2B6E-4134-AAF8-9101457D709A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {00A2F7A3-BEC3-48F4-A91C-5A336C32A5D2} = {E8067AED-2B6E-4134-AAF8-9101457D709A} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {972464AB-1B23-4D87-89A2-13271E1873B9} + EndGlobalSection +EndGlobal diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.cs b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.cs index 7fca53e66..42bd70aa6 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.cs +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/InternalApiGatewayModule.cs @@ -1,5 +1,5 @@ -using LINGYUN.Abp.AspNetCore.HttpOverrides; -using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.Application; +using LINGYUN.Abp.Serilog.Enrichers.UniqueId; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -19,9 +19,9 @@ namespace LINGYUN.MicroService.Internal.ApiGateway [DependsOn( typeof(AbpAutofacModule), typeof(AbpSerilogEnrichersApplicationModule), + typeof(AbpSerilogEnrichersUniqueIdModule), typeof(AbpCachingStackExchangeRedisModule), - typeof(AbpAspNetCoreSerilogModule), - typeof(AbpAspNetCoreHttpOverridesModule) + typeof(AbpAspNetCoreSerilogModule) )] public partial class InternalApiGatewayModule : AbpModule { @@ -53,7 +53,6 @@ namespace LINGYUN.MicroService.Internal.ApiGateway public override void OnApplicationInitialization(ApplicationInitializationContext context) { var app = context.GetApplicationBuilder(); - app.UseForwardedHeaders(); app.UseAuditing(); app.UseStaticFiles(); app.UseRouting(); diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj index 93eed49f4..9c736397a 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/LINGYUN.MicroService.Internal.ApiGateway.csproj @@ -31,9 +31,9 @@ - + diff --git a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.json b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.json index 64b3ec6be..a7f5f8376 100644 --- a/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.json +++ b/gateways/internal/LINGYUN.MicroService.Internal.ApiGateway/src/LINGYUN.MicroService.Internal.ApiGateway/appsettings.json @@ -19,7 +19,7 @@ "Microsoft": "Warning" } }, - "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName" ], + "Enrich": [ "FromLogContext", "WithProcessId", "WithThreadId", "WithEnvironmentName", "WithMachineName", "WithApplicationName", "WithUniqueId" ], "WriteTo": [ { "Name": "Console",