|
|
@ -1,14 +1,12 @@ |
|
|
using DotNetCore.CAP; |
|
|
using DotNetCore.CAP; |
|
|
using Hangfire; |
|
|
|
|
|
using LINGYUN.Abp.AspNetCore.HttpOverrides; |
|
|
using LINGYUN.Abp.AspNetCore.HttpOverrides; |
|
|
using LINGYUN.Abp.AuditLogging.Elasticsearch; |
|
|
using LINGYUN.Abp.AuditLogging.Elasticsearch; |
|
|
using LINGYUN.Abp.Authorization.OrganizationUnits; |
|
|
using LINGYUN.Abp.Authorization.OrganizationUnits; |
|
|
using LINGYUN.Abp.BackgroundJobs.Hangfire; |
|
|
using LINGYUN.Abp.BackgroundTasks.ExceptionHandling; |
|
|
using LINGYUN.Abp.BackgroundWorkers.Hangfire; |
|
|
using LINGYUN.Abp.BackgroundTasks.Quartz; |
|
|
using LINGYUN.Abp.Data.DbMigrator; |
|
|
using LINGYUN.Abp.Data.DbMigrator; |
|
|
using LINGYUN.Abp.EventBus.CAP; |
|
|
using LINGYUN.Abp.EventBus.CAP; |
|
|
using LINGYUN.Abp.ExceptionHandling.Notifications; |
|
|
using LINGYUN.Abp.ExceptionHandling.Notifications; |
|
|
using LINGYUN.Abp.Hangfire.Storage.MySql; |
|
|
|
|
|
using LINGYUN.Abp.Identity.WeChat; |
|
|
using LINGYUN.Abp.Identity.WeChat; |
|
|
using LINGYUN.Abp.IM.SignalR; |
|
|
using LINGYUN.Abp.IM.SignalR; |
|
|
using LINGYUN.Abp.Localization.CultureMap; |
|
|
using LINGYUN.Abp.Localization.CultureMap; |
|
|
@ -21,6 +19,7 @@ using LINGYUN.Abp.Notifications.WeChat.MiniProgram; |
|
|
using LINGYUN.Abp.Saas.EntityFrameworkCore; |
|
|
using LINGYUN.Abp.Saas.EntityFrameworkCore; |
|
|
using LINGYUN.Abp.Serilog.Enrichers.Application; |
|
|
using LINGYUN.Abp.Serilog.Enrichers.Application; |
|
|
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; |
|
|
using LINGYUN.Abp.Serilog.Enrichers.UniqueId; |
|
|
|
|
|
using LINGYUN.Abp.TaskManagement.EntityFrameworkCore; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
@ -37,9 +36,9 @@ using Volo.Abp.Modularity; |
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.PermissionManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
|
using Volo.Abp.SettingManagement.EntityFrameworkCore; |
|
|
|
|
|
|
|
|
namespace LY.MicroService.RealtimeMessage |
|
|
namespace LY.MicroService.RealtimeMessage; |
|
|
{ |
|
|
|
|
|
[DependsOn( |
|
|
[DependsOn( |
|
|
typeof(AbpSerilogEnrichersApplicationModule), |
|
|
typeof(AbpSerilogEnrichersApplicationModule), |
|
|
typeof(AbpSerilogEnrichersUniqueIdModule), |
|
|
typeof(AbpSerilogEnrichersUniqueIdModule), |
|
|
typeof(AbpAspNetCoreSerilogModule), |
|
|
typeof(AbpAspNetCoreSerilogModule), |
|
|
@ -48,6 +47,9 @@ namespace LY.MicroService.RealtimeMessage |
|
|
typeof(AbpMessageServiceApplicationModule), |
|
|
typeof(AbpMessageServiceApplicationModule), |
|
|
typeof(AbpMessageServiceHttpApiModule), |
|
|
typeof(AbpMessageServiceHttpApiModule), |
|
|
typeof(AbpIdentityWeChatModule), |
|
|
typeof(AbpIdentityWeChatModule), |
|
|
|
|
|
typeof(AbpBackgroundTasksQuartzModule), |
|
|
|
|
|
typeof(AbpBackgroundTasksExceptionHandlingModule), |
|
|
|
|
|
typeof(TaskManagementEntityFrameworkCoreModule), |
|
|
typeof(AbpMessageServiceEntityFrameworkCoreModule), |
|
|
typeof(AbpMessageServiceEntityFrameworkCoreModule), |
|
|
typeof(AbpIdentityEntityFrameworkCoreModule), |
|
|
typeof(AbpIdentityEntityFrameworkCoreModule), |
|
|
typeof(AbpSaasEntityFrameworkCoreModule), |
|
|
typeof(AbpSaasEntityFrameworkCoreModule), |
|
|
@ -57,9 +59,6 @@ namespace LY.MicroService.RealtimeMessage |
|
|
typeof(AbpDataDbMigratorModule), |
|
|
typeof(AbpDataDbMigratorModule), |
|
|
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|
|
typeof(AbpAspNetCoreAuthenticationJwtBearerModule), |
|
|
typeof(AbpAuthorizationOrganizationUnitsModule), |
|
|
typeof(AbpAuthorizationOrganizationUnitsModule), |
|
|
typeof(AbpHangfireMySqlStorageModule), |
|
|
|
|
|
typeof(AbpBackgroundJobsHangfireModule), |
|
|
|
|
|
typeof(AbpBackgroundWorkersHangfireModule), |
|
|
|
|
|
typeof(AbpBackgroundWorkersModule), |
|
|
typeof(AbpBackgroundWorkersModule), |
|
|
typeof(AbpIMSignalRModule), |
|
|
typeof(AbpIMSignalRModule), |
|
|
typeof(AbpNotificationsSmsModule), |
|
|
typeof(AbpNotificationsSmsModule), |
|
|
@ -72,79 +71,75 @@ namespace LY.MicroService.RealtimeMessage |
|
|
typeof(AbpLocalizationCultureMapModule), |
|
|
typeof(AbpLocalizationCultureMapModule), |
|
|
typeof(AbpAutofacModule) |
|
|
typeof(AbpAutofacModule) |
|
|
)] |
|
|
)] |
|
|
public partial class RealtimeMessageHttpApiHostModule : AbpModule |
|
|
public partial class RealtimeMessageHttpApiHostModule : AbpModule |
|
|
{ |
|
|
{ |
|
|
private const string DefaultCorsPolicyName = "Default"; |
|
|
private const string DefaultCorsPolicyName = "Default"; |
|
|
|
|
|
|
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
public override void PreConfigureServices(ServiceConfigurationContext context) |
|
|
{ |
|
|
{ |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
|
PreConfigureApp(); |
|
|
PreConfigureApp(); |
|
|
PreConfigureFeature(); |
|
|
PreConfigureFeature(); |
|
|
PreCongifureHangfire(); |
|
|
PreConfigureCAP(configuration); |
|
|
PreConfigureCAP(configuration); |
|
|
PreConfigureQuartz(configuration); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
public override void ConfigureServices(ServiceConfigurationContext context) |
|
|
{ |
|
|
{ |
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
var hostingEnvironment = context.Services.GetHostingEnvironment(); |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
var configuration = context.Services.GetConfiguration(); |
|
|
|
|
|
|
|
|
ConfigureDbContext(); |
|
|
ConfigureDbContext(); |
|
|
ConfigureLocalization(); |
|
|
ConfigureLocalization(); |
|
|
ConfigureJsonSerializer(); |
|
|
ConfigureJsonSerializer(); |
|
|
ConfigreExceptionHandling(); |
|
|
ConfigureBackgroundTasks(); |
|
|
ConfigureVirtualFileSystem(); |
|
|
ConfigreExceptionHandling(); |
|
|
ConfigureCaching(configuration); |
|
|
ConfigureVirtualFileSystem(); |
|
|
ConfigureAuditing(configuration); |
|
|
ConfigureCaching(configuration); |
|
|
ConfigureSwagger(context.Services); |
|
|
ConfigureAuditing(configuration); |
|
|
ConfigureMultiTenancy(configuration); |
|
|
ConfigureSwagger(context.Services); |
|
|
ConfigureHangfireServer(context.Services); |
|
|
ConfigureMultiTenancy(configuration); |
|
|
ConfigureCors(context.Services, configuration); |
|
|
ConfigureCors(context.Services, configuration); |
|
|
ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); |
|
|
ConfigureSeedWorker(context.Services, hostingEnvironment.IsDevelopment()); |
|
|
ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); |
|
|
ConfigureSecurity(context.Services, configuration, hostingEnvironment.IsDevelopment()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
public override void OnApplicationInitialization(ApplicationInitializationContext context) |
|
|
|
|
|
{ |
|
|
|
|
|
var app = context.GetApplicationBuilder(); |
|
|
|
|
|
// http调用链
|
|
|
|
|
|
app.UseCorrelationId(); |
|
|
|
|
|
// 虚拟文件系统
|
|
|
|
|
|
app.UseStaticFiles(); |
|
|
|
|
|
// 路由
|
|
|
|
|
|
app.UseRouting(); |
|
|
|
|
|
// 跨域
|
|
|
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
|
|
// 认证
|
|
|
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
app.UseAbpClaimsMap(); |
|
|
|
|
|
// jwt
|
|
|
|
|
|
app.UseJwtTokenMiddleware(); |
|
|
|
|
|
// 多租户
|
|
|
|
|
|
app.UseMultiTenancy(); |
|
|
|
|
|
// 本地化
|
|
|
|
|
|
app.UseMapRequestLocalization(); |
|
|
|
|
|
// 授权
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
// Cap Dashboard
|
|
|
|
|
|
app.UseCapDashboard(); |
|
|
|
|
|
// Swagger
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
|
|
// Swagger可视化界面
|
|
|
|
|
|
app.UseSwaggerUI(options => |
|
|
{ |
|
|
{ |
|
|
var app = context.GetApplicationBuilder(); |
|
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support Realtime Message API"); |
|
|
// http调用链
|
|
|
}); |
|
|
app.UseCorrelationId(); |
|
|
// 审计日志
|
|
|
// 虚拟文件系统
|
|
|
app.UseAuditing(); |
|
|
app.UseStaticFiles(); |
|
|
app.UseAbpSerilogEnrichers(); |
|
|
// 路由
|
|
|
// 路由
|
|
|
app.UseRouting(); |
|
|
app.UseConfiguredEndpoints(); |
|
|
// 跨域
|
|
|
|
|
|
app.UseCors(DefaultCorsPolicyName); |
|
|
|
|
|
// 认证
|
|
|
|
|
|
app.UseAuthentication(); |
|
|
|
|
|
app.UseAbpClaimsMap(); |
|
|
|
|
|
// jwt
|
|
|
|
|
|
app.UseJwtTokenMiddleware(); |
|
|
|
|
|
// 多租户
|
|
|
|
|
|
app.UseMultiTenancy(); |
|
|
|
|
|
// 本地化
|
|
|
|
|
|
app.UseMapRequestLocalization(); |
|
|
|
|
|
// 授权
|
|
|
|
|
|
app.UseAuthorization(); |
|
|
|
|
|
// Cap Dashboard
|
|
|
|
|
|
app.UseCapDashboard(); |
|
|
|
|
|
// Swagger
|
|
|
|
|
|
app.UseSwagger(); |
|
|
|
|
|
// Swagger可视化界面
|
|
|
|
|
|
app.UseSwaggerUI(options => |
|
|
|
|
|
{ |
|
|
|
|
|
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Support Realtime Message API"); |
|
|
|
|
|
}); |
|
|
|
|
|
// 审计日志
|
|
|
|
|
|
app.UseAuditing(); |
|
|
|
|
|
app.UseAbpSerilogEnrichers(); |
|
|
|
|
|
// 将在 2.0.0版本移除
|
|
|
|
|
|
// app.UseHangfireServer();
|
|
|
|
|
|
app.UseHangfireDashboard(); |
|
|
|
|
|
// 路由
|
|
|
|
|
|
app.UseConfiguredEndpoints(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|