Program修改为新版本写法
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
bcc9e1c761
commit
edbcabace6
|
@ -1,231 +0,0 @@
|
|||
//using Autofac;
|
||||
//using Autofac.Extensions.DependencyInjection;
|
||||
//using IRaCIS.Core.API;
|
||||
//using IRaCIS.Core.Application.Filter;
|
||||
//using IRaCIS.Core.Application.MediatR.Handlers;
|
||||
//using LogDashboard;
|
||||
//using MassTransit;
|
||||
//using MassTransit.NewIdProviders;
|
||||
//using MediatR;
|
||||
//using Microsoft.AspNetCore.Builder;
|
||||
//using Microsoft.AspNetCore.Http.Features;
|
||||
//using Microsoft.AspNetCore.HttpOverrides;
|
||||
//using Microsoft.AspNetCore.SignalR;
|
||||
//using Microsoft.Extensions.Configuration;
|
||||
//using Microsoft.Extensions.DependencyInjection;
|
||||
//using Microsoft.Extensions.Hosting;
|
||||
//using Serilog;
|
||||
//using System;
|
||||
|
||||
//var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
// //以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数)
|
||||
// var config = new ConfigurationBuilder()
|
||||
// .AddEnvironmentVariables()
|
||||
// .Build();
|
||||
|
||||
// var enviromentName = config["ASPNETCORE_ENVIRONMENT"];
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(enviromentName))
|
||||
// {
|
||||
|
||||
// var index = Array.IndexOf(args, "--env");
|
||||
// enviromentName = index > -1
|
||||
// ? args[index + 1]
|
||||
// : "Development";
|
||||
// }
|
||||
|
||||
|
||||
// NewId.SetProcessIdProvider(new CurrentProcessIdProvider());
|
||||
|
||||
|
||||
|
||||
|
||||
//builder.Host.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
// .ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
||||
// {
|
||||
// containerBuilder.RegisterModule<AutofacModuleSetup>();
|
||||
// })
|
||||
// .UseWindowsService().UseSerilog();
|
||||
|
||||
|
||||
|
||||
//// Add services to the container.
|
||||
|
||||
////本地化
|
||||
//builder.Services.AddJsonLocalization(options => options.ResourcesPath = "Resources");
|
||||
|
||||
//// 异常、参数统一验证过滤器、Json序列化配置、字符串参数绑型统一Trim()
|
||||
//builder.Services.AddControllers(options =>
|
||||
//{
|
||||
// //options.Filters.Add<LogActionFilter>();
|
||||
// options.Filters.Add<ModelActionFilter>();
|
||||
// options.Filters.Add<ProjectExceptionFilter>();
|
||||
// //options.Filters.Add<UnitOfWorkFilter>();
|
||||
|
||||
// //if (_configuration.GetSection("BasicSystemConfig").GetValue<bool>("OpenLoginLimit"))
|
||||
// //{
|
||||
// // options.Filters.Add<LimitUserRequestAuthorization>();
|
||||
|
||||
// //}
|
||||
|
||||
|
||||
//}).AddNewtonsoftJsonSetup(); // NewtonsoftJson 序列化 处理
|
||||
|
||||
////动态WebApi + UnifiedApiResultFilter 省掉控制器代码
|
||||
//builder.Services.AddDynamicWebApiSetup();
|
||||
////AutoMapper
|
||||
//builder.Services.AddAutoMapperSetup();
|
||||
////EF ORM QueryWithNoLock
|
||||
//builder.Services.AddEFSetup(builder.Configuration);
|
||||
////Http 响应压缩
|
||||
//builder.Services.AddResponseCompressionSetup();
|
||||
////Swagger Api 文档
|
||||
//builder.Services.AddSwaggerSetup();
|
||||
////JWT Token 验证
|
||||
//builder.Services.AddJWTAuthSetup(builder.Configuration);
|
||||
//// MediatR 进程内消息 事件解耦 从程序集中 注册命令和handler对应关系
|
||||
//builder.Services.AddMediatR(typeof(ConsistencyVerificationHandler).Assembly);
|
||||
//// EasyCaching 缓存
|
||||
//builder.Services.AddEasyCachingSetup();
|
||||
|
||||
////services.AddDistributedMemoryCache();
|
||||
|
||||
////// hangfire 定时任务框架 有界面,更友好~
|
||||
//builder.Services.AddhangfireSetup(builder.Configuration);
|
||||
////// QuartZ 定时任务框架 使用了hangfire 暂时不用,后续需要可以打开,已经配好
|
||||
////builder.Services.AddQuartZSetup(_configuration);
|
||||
|
||||
//// 保护上传文件
|
||||
////services.AddStaticFileAuthorizationSetup();
|
||||
|
||||
|
||||
//////HttpReports 暂时废弃
|
||||
////services.AddHttpReports().AddHttpTransport();
|
||||
////Serilog 日志可视化 LogDashboard日志
|
||||
//builder.Services.AddLogDashboardSetup();
|
||||
////上传限制 配置
|
||||
//builder.Services.Configure<FormOptions>(options =>
|
||||
//{
|
||||
// options.MultipartBodyLengthLimit = int.MaxValue;
|
||||
// options.ValueCountLimit = int.MaxValue;
|
||||
// options.ValueLengthLimit = int.MaxValue;
|
||||
//});
|
||||
////IP 限流 可设置白名单 或者黑名单
|
||||
////services.AddIpPolicyRateLimitSetup(_configuration);
|
||||
////用户类型 策略授权
|
||||
//builder.Services.AddAuthorizationPolicySetup(builder.Configuration);
|
||||
|
||||
//builder.Services.AddJsonConfigSetup(builder.Configuration);
|
||||
|
||||
////转发头设置 获取真实IP
|
||||
//builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
//{
|
||||
// options.ForwardedHeaders =
|
||||
// ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
//});
|
||||
////Dicom影像渲染图片 跨平台
|
||||
//builder.Services.AddDicomSetup();
|
||||
|
||||
//// 实时应用
|
||||
//builder.Services.AddSignalR();
|
||||
|
||||
|
||||
//builder.Services.AddSingleton<IUserIdProvider, IRaCISUserIdProvider>();
|
||||
|
||||
//builder.Services.AddControllers();
|
||||
//// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
|
||||
////builder.Services.AddEndpointsApiExplorer();
|
||||
////builder.Services.AddSwaggerGen();
|
||||
|
||||
////SerilogExtension.AddSerilogSetup(enviromentName, builder.Host.confi);
|
||||
|
||||
|
||||
//var app = builder.Build();
|
||||
|
||||
//// Configure the HTTP request pipeline.
|
||||
|
||||
////本地化
|
||||
//app.UseLocalization();
|
||||
|
||||
//app.UseForwardedHeaders();
|
||||
|
||||
|
||||
////不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication.
|
||||
//app.UseStaticFiles();
|
||||
|
||||
//app.UseIRacisHostStaticFileStore(app.Environment);
|
||||
|
||||
////LogDashboard
|
||||
//app.UseLogDashboard("/LogDashboard");
|
||||
|
||||
////hangfire
|
||||
////app.UseHangfireConfig(app.Environment);
|
||||
|
||||
//////暂时废弃
|
||||
////app.UseHttpReports();
|
||||
|
||||
//////限流 中间件
|
||||
////app.UseIpRateLimiting();
|
||||
|
||||
////响应压缩
|
||||
//app.UseResponseCompression();
|
||||
|
||||
//if (app.Environment.IsDevelopment())
|
||||
//{
|
||||
// app.UseDeveloperExceptionPage();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
|
||||
// //app.UseHsts();
|
||||
//}
|
||||
|
||||
//SwaggerSetup.Configure(app, app.Environment);
|
||||
|
||||
//Console.WriteLine("当前环境: " + builder.Environment.EnvironmentName);
|
||||
|
||||
////app.UseMiddleware<AuthMiddleware>();
|
||||
|
||||
//// 特殊异常处理 比如 404
|
||||
//app.UseStatusCodePagesWithReExecute("/Error/{0}");
|
||||
|
||||
|
||||
|
||||
|
||||
//////serilog 记录请求的用户信息
|
||||
//app.UseSerilogConfig(app.Environment);
|
||||
|
||||
//app.UseRouting();
|
||||
|
||||
//app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
||||
|
||||
|
||||
//app.UseAuthentication();
|
||||
////app.UseJwtBearerQueryString();
|
||||
//app.UseAuthorization();
|
||||
|
||||
//////文件伺服 必须带Token 访问
|
||||
//////app.UseIRacisHostStaticFileStore(env);
|
||||
|
||||
|
||||
|
||||
////app.UseEndpoints(endpoints =>
|
||||
////{
|
||||
|
||||
|
||||
//// endpoints.MapControllers();
|
||||
|
||||
//// endpoints.MapHub<UploadHub>("/UploadHub")/*.RequireCors(t=>t.WithOrigins(new string[] {"null"}).AllowAnyMethod().AllowAnyHeader().AllowCredentials())*/;
|
||||
////});
|
||||
|
||||
|
||||
|
||||
//app.MapControllers();
|
||||
//app.MapHub<UploadHub>("/UploadHub")/*.RequireCors(t=>t.WithOrigins(new string[] {"null"}).AllowAnyMethod().AllowAnyHeader().AllowCredentials())*/;
|
||||
|
||||
|
||||
//app.Run();
|
||||
|
||||
//测试同步
|
Binary file not shown.
|
@ -4,34 +4,6 @@
|
|||
<name>IRaCIS.Core.API</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:EasyCaching.Demo.Interceptors.Controllers.ErrorController.Error(System.Int32)">
|
||||
<summary>
|
||||
主要处理 前端404等错误 全局业务异常已统一处理了,非业务错误会来到这里
|
||||
</summary>
|
||||
<param name="code"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Api.Controllers.ExtraController">
|
||||
<summary>
|
||||
医生基本信息 、工作信息 专业信息、审核状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.GetDoctorDetail(IRaCIS.Application.Interfaces.IAttachmentService,IRaCIS.Application.Interfaces.IDoctorService,IRaCIS.Application.Interfaces.IEducationService,IRaCIS.Application.Interfaces.ITrialExperienceService,IRaCIS.Application.Interfaces.IResearchPublicationService,IRaCIS.Application.Interfaces.IVacationService,System.Guid)">
|
||||
<summary>
|
||||
获取医生详情
|
||||
</summary>
|
||||
<param name="attachmentService"></param>
|
||||
<param name="_doctorService"></param>
|
||||
<param name="_educationService"></param>
|
||||
<param name="_trialExperienceService"></param>
|
||||
<param name="_researchPublicationService"></param>
|
||||
<param name="_vacationService"></param>
|
||||
<param name="doctorId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,EasyCaching.Core.IEasyCachingProvider,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary> 系统用户登录接口[New] </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Core.API.Controllers.Special.FinancialChangeController.AddOrUpdateTrialInspection(IRaCIS.Core.Application.Service.Inspection.DTO.DataInspectionDto{IRaCIS.Application.Contracts.TrialCommand})">
|
||||
<summary> 添加实验项目-返回新增Id[AUTH]</summary>
|
||||
<returns>新记录Id</returns>
|
||||
|
@ -373,6 +345,27 @@
|
|||
<param name="memberSerialization">序列化成员</param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:IRaCIS.Api.Controllers.ExtraController">
|
||||
<summary>
|
||||
医生基本信息 、工作信息 专业信息、审核状态
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.GetDoctorDetail(IRaCIS.Application.Interfaces.IAttachmentService,IRaCIS.Application.Interfaces.IDoctorService,IRaCIS.Application.Interfaces.IEducationService,IRaCIS.Application.Interfaces.ITrialExperienceService,IRaCIS.Application.Interfaces.IResearchPublicationService,IRaCIS.Application.Interfaces.IVacationService,System.Guid)">
|
||||
<summary>
|
||||
获取医生详情
|
||||
</summary>
|
||||
<param name="attachmentService"></param>
|
||||
<param name="_doctorService"></param>
|
||||
<param name="_educationService"></param>
|
||||
<param name="_trialExperienceService"></param>
|
||||
<param name="_researchPublicationService"></param>
|
||||
<param name="_vacationService"></param>
|
||||
<param name="doctorId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:IRaCIS.Api.Controllers.ExtraController.Login(IRaCIS.Application.Contracts.UserLoginDTO,EasyCaching.Core.IEasyCachingProvider,IRaCIS.Application.Services.IUserService,IRaCIS.Core.Application.Auth.ITokenService,Microsoft.Extensions.Configuration.IConfiguration)">
|
||||
<summary> 系统用户登录接口[New] </summary>
|
||||
</member>
|
||||
<member name="M:IRaCIS.WX.CoreApi.Auth.AuthMiddleware.Invoke(Microsoft.AspNetCore.Http.HttpContext)">
|
||||
<summary>
|
||||
为了前端 一段时间无操作,需要重新登陆
|
||||
|
@ -380,6 +373,13 @@
|
|||
<param name="httpContext"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:EasyCaching.Demo.Interceptors.Controllers.ErrorController.Error(System.Int32)">
|
||||
<summary>
|
||||
主要处理 前端404等错误 全局业务异常已统一处理了,非业务错误会来到这里
|
||||
</summary>
|
||||
<param name="code"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:ZhaoXi._001.NET5Demo.Practice.WebApi.Utility.Jwt.CustomHSJWTService">
|
||||
<summary>
|
||||
对称可逆加密
|
||||
|
|
|
@ -0,0 +1,265 @@
|
|||
using System;
|
||||
using Autofac.Extensions.DependencyInjection;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Serilog;
|
||||
using MediatR;
|
||||
using IRaCIS.Core.Application.MediatR.Handlers;
|
||||
using System.Threading.Tasks;
|
||||
using MassTransit;
|
||||
using MassTransit.NewIdProviders;
|
||||
using System.IO;
|
||||
using IRaCIS.Core.Domain.Share;
|
||||
using IRaCIS.Core.Infra.EFCore;
|
||||
using IRaCIS.Core.Application.Helper;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using IRaCIS.Core.API;
|
||||
using Autofac;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.SignalR;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using IRaCIS.Core.Application.Filter;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using IRaCIS.Application.Services.BackGroundJob;
|
||||
using LogDashboard;
|
||||
|
||||
|
||||
|
||||
#region 环境变量设置,以及部署运维平台
|
||||
|
||||
//以配置文件为准,否则 从url中取环境值(服务以命令行传递参数启动,配置文件配置了就不需要传递环境参数)
|
||||
var config = new ConfigurationBuilder()
|
||||
.AddEnvironmentVariables()
|
||||
.Build();
|
||||
|
||||
var enviromentName = config["ASPNETCORE_ENVIRONMENT"];
|
||||
|
||||
if (string.IsNullOrWhiteSpace(enviromentName))
|
||||
{
|
||||
|
||||
var index = Array.IndexOf(args, "--env");
|
||||
enviromentName = index > -1
|
||||
? args[index + 1]
|
||||
: "Development";
|
||||
}
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
{
|
||||
Log.Logger.Warning($"当前部署平台环境:windows");
|
||||
}
|
||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||
{
|
||||
Log.Logger.Warning($"当前部署平台环境:linux");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Logger.Warning($"当前部署平台环境:OSX or FreeBSD");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
NewId.SetProcessIdProvider(new CurrentProcessIdProvider());
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Host.UseEnvironment(enviromentName)
|
||||
.ConfigureAppConfiguration((hostContext, config) =>
|
||||
{
|
||||
|
||||
//Console.WriteLine(hostContext.HostingEnvironment.EnvironmentName);
|
||||
config.AddJsonFile("appsettings.json", false, true)
|
||||
.AddJsonFile($"appsettings.{enviromentName}.json", false, true);
|
||||
})
|
||||
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
|
||||
.ConfigureContainer<ContainerBuilder>(containerBuilder =>
|
||||
{
|
||||
containerBuilder.RegisterModule<AutofacModuleSetup>();
|
||||
})
|
||||
.UseWindowsService().UseSerilog();
|
||||
|
||||
|
||||
|
||||
|
||||
#region 配置服务
|
||||
var _configuration = builder.Configuration;
|
||||
|
||||
//健康检查
|
||||
builder.Services.AddHealthChecks();
|
||||
//本地化
|
||||
builder.Services.AddJsonLocalization(options => options.ResourcesPath = "Resources");
|
||||
|
||||
// 异常、参数统一验证过滤器、Json序列化配置、字符串参数绑型统一Trim()
|
||||
builder.Services.AddControllers(options =>
|
||||
{
|
||||
//options.Filters.Add<LogActionFilter>();
|
||||
options.Filters.Add<ModelActionFilter>();
|
||||
options.Filters.Add<ProjectExceptionFilter>();
|
||||
options.Filters.Add<UnitOfWorkFilter>();
|
||||
|
||||
if (_configuration.GetSection("BasicSystemConfig").GetValue<bool>("OpenLoginLimit"))
|
||||
{
|
||||
options.Filters.Add<LimitUserRequestAuthorization>();
|
||||
}
|
||||
|
||||
})
|
||||
.AddNewtonsoftJsonSetup(); // NewtonsoftJson 序列化 处理
|
||||
|
||||
builder.Services.AddOptions().Configure<SystemEmailSendConfig>(_configuration.GetSection("SystemEmailSendConfig"));
|
||||
builder.Services.AddOptions().Configure<ServiceVerifyConfigOption>(_configuration.GetSection("BasicSystemConfig"));
|
||||
builder.Services.AddOptions().Configure<AliyunOSSOptions>(_configuration.GetSection("AliyunOSS"));
|
||||
builder.Services.AddOptions().Configure<ObjectStoreServiceOptions>(_configuration.GetSection("ObjectStoreService"));
|
||||
|
||||
|
||||
//动态WebApi + UnifiedApiResultFilter 省掉控制器代码
|
||||
builder.Services.AddDynamicWebApiSetup();
|
||||
//AutoMapper
|
||||
builder.Services.AddAutoMapperSetup();
|
||||
//EF ORM QueryWithNoLock
|
||||
builder.Services.AddEFSetup(_configuration);
|
||||
//Http 响应压缩
|
||||
builder.Services.AddResponseCompressionSetup();
|
||||
//Swagger Api 文档
|
||||
builder.Services.AddSwaggerSetup();
|
||||
//JWT Token 验证
|
||||
builder.Services.AddJWTAuthSetup(_configuration);
|
||||
|
||||
// MediatR 进程内消息 事件解耦 从程序集中 注册命令和handler对应关系
|
||||
builder.Services.AddMediatR(cfg => cfg.RegisterServicesFromAssemblyContaining<ConsistencyVerificationHandler>());
|
||||
// EasyCaching 缓存
|
||||
builder.Services.AddEasyCachingSetup(_configuration);
|
||||
|
||||
// hangfire 定时任务框架 有界面,更友好~
|
||||
builder.Services.AddhangfireSetup(_configuration);
|
||||
|
||||
|
||||
//Serilog 日志可视化 LogDashboard日志
|
||||
builder.Services.AddLogDashboardSetup();
|
||||
|
||||
|
||||
builder.Services.AddJsonConfigSetup(_configuration);
|
||||
//转发头设置 获取真实IP
|
||||
builder.Services.Configure<ForwardedHeadersOptions>(options =>
|
||||
{
|
||||
options.ForwardedHeaders =
|
||||
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
||||
});
|
||||
//Dicom影像渲染图片 跨平台
|
||||
builder.Services.AddDicomSetup();
|
||||
|
||||
// 实时应用
|
||||
builder.Services.AddSignalR();
|
||||
|
||||
builder.Services.AddSingleton<IUserIdProvider, IRaCISUserIdProvider>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#region 历史废弃配置
|
||||
//builder.Services.AddMemoryCache();
|
||||
////上传限制 配置
|
||||
//builder.Services.Configure<FormOptions>(options =>
|
||||
//{
|
||||
// options.MultipartBodyLengthLimit = int.MaxValue;
|
||||
// options.ValueCountLimit = int.MaxValue;
|
||||
// options.ValueLengthLimit = int.MaxValue;
|
||||
//});
|
||||
//IP 限流 可设置白名单 或者黑名单
|
||||
//services.AddIpPolicyRateLimitSetup(_configuration);
|
||||
// 用户类型 策略授权
|
||||
//services.AddAuthorizationPolicySetup(_configuration);
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
var app = builder.Build();
|
||||
var env = app.Environment;
|
||||
|
||||
#region 配置中间件
|
||||
|
||||
|
||||
// Configure the HTTP request pipeline.
|
||||
|
||||
//本地化
|
||||
app.UseLocalization();
|
||||
|
||||
app.UseForwardedHeaders();
|
||||
|
||||
//响应压缩
|
||||
app.UseResponseCompression();
|
||||
|
||||
//app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
||||
|
||||
//不需要 token 访问的静态文件 wwwroot css, JavaScript, and images don't require authentication.
|
||||
app.UseStaticFiles();
|
||||
|
||||
app.UseMiddleware<MultiDiskStaticFilesMiddleware>();
|
||||
|
||||
//LogDashboard
|
||||
app.UseLogDashboard("/LogDashboard");
|
||||
|
||||
//hangfire
|
||||
app.UseHangfireConfig(env);
|
||||
|
||||
|
||||
////限流 中间件
|
||||
//app.UseIpRateLimiting();
|
||||
|
||||
|
||||
if (env.IsDevelopment())
|
||||
{
|
||||
app.UseDeveloperExceptionPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
//app.UseHsts();
|
||||
}
|
||||
|
||||
// 特殊异常处理 比如 404
|
||||
app.UseStatusCodePagesWithReExecute("/Error/{0}");
|
||||
|
||||
SwaggerSetup.Configure(app, env);
|
||||
|
||||
|
||||
////serilog 记录请求的用户信息
|
||||
app.UseSerilogConfig(env);
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
app.UseCors(t => t.AllowAnyOrigin().AllowAnyMethod().AllowAnyHeader());
|
||||
|
||||
//app.UseIRacisHostStaticFileStore(env);
|
||||
|
||||
|
||||
app.UseAuthentication();
|
||||
app.UseAuthorization();
|
||||
|
||||
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
|
||||
endpoints.MapHub<UploadHub>("/UploadHub");
|
||||
|
||||
endpoints.MapHealthChecks("/health");
|
||||
});
|
||||
|
||||
// Serilog
|
||||
SerilogExtension.AddSerilogSetup(enviromentName, app.Services);
|
||||
|
||||
Log.Logger.Warning($"当前环境:{enviromentName}");
|
||||
|
||||
var hangfireJobService = app.Services.GetRequiredService<IIRaCISHangfireJob>();
|
||||
|
||||
await hangfireJobService.InitHangfireJobTaskAsync();
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
app.Run();
|
||||
|
||||
|
||||
|
|
@ -12,6 +12,7 @@ using Microsoft.Identity.Client;
|
|||
using static IRaCIS.Core.Domain.Share.StaticData;
|
||||
using IRaCIS.Core.Application.ViewModel;
|
||||
using Medallion.Threading;
|
||||
using EasyCaching.Core;
|
||||
|
||||
namespace IRaCIS.Application.Services
|
||||
{
|
||||
|
@ -26,7 +27,7 @@ namespace IRaCIS.Application.Services
|
|||
private readonly IRepository<UserLog> _userLogRepository;
|
||||
|
||||
private readonly IDistributedLockProvider _distributedLockProvider;
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly IEasyCachingProvider _cache;
|
||||
|
||||
private readonly IOptionsMonitor<ServiceVerifyConfigOption> _verifyConfig;
|
||||
|
||||
|
@ -36,7 +37,7 @@ namespace IRaCIS.Application.Services
|
|||
IMailVerificationService mailVerificationService,
|
||||
IRepository<VerificationCode> verificationCodeRepository,
|
||||
IRepository<Doctor> doctorRepository,
|
||||
IMemoryCache cache,
|
||||
IEasyCachingProvider cache,
|
||||
IRepository<TrialUser> userTrialRepository,
|
||||
IOptionsMonitor<ServiceVerifyConfigOption> verifyConfig,
|
||||
IRepository<UserLog> userLogRepository
|
||||
|
@ -631,7 +632,7 @@ namespace IRaCIS.Application.Services
|
|||
string cacheKey = $"{cachePrefix}{userName}";
|
||||
|
||||
// 从缓存中获取登录失败次数
|
||||
int? failCount = _cache.Get<int?>(cacheKey);
|
||||
int? failCount = _cache.Get<int?>(cacheKey).Value;
|
||||
|
||||
if (failCount == null)
|
||||
{
|
||||
|
|
|
@ -62,12 +62,10 @@ namespace IRaCIS.Application.Services
|
|||
private readonly IRepository<NoneDicomStudyFile> _noneDicomStudyFileSystem;
|
||||
private readonly IRepository<ReadingQuestionTrial> _readingQuestionTrialRepository;
|
||||
|
||||
private readonly IMemoryCache _cache;
|
||||
private readonly ITrialEmailNoticeConfigService _trialEmailNoticeConfigService;
|
||||
|
||||
|
||||
public ReadingImageTaskService(
|
||||
IMapper mapper,
|
||||
IRepository<NoneDicomStudy> noneDicomStudyRepository,
|
||||
IRepository<VisitTask> visitTaskRepository,
|
||||
IRepository<Trial> TrialRepository,
|
||||
|
@ -90,8 +88,7 @@ namespace IRaCIS.Application.Services
|
|||
IRepository<User> userRepository,
|
||||
IEasyCachingProvider provider,
|
||||
IRepository<ReadingCustomTag> readingCustomTagRepository,
|
||||
IRepository<ReadingTaskQuestionMark> readingTaskQuestionMarkRepository,
|
||||
IMemoryCache cache,
|
||||
IRepository<ReadingTaskQuestionMark> readingTaskQuestionMarkRepository,
|
||||
IRepository<ReadingSystemCriterionDictionary> readingCriterionDictionaryRepository,
|
||||
IRepository<ReadingTrialCriterionDictionary> readingTrialCriterionDictionaryRepository,
|
||||
IRepository<TumorAssessment_RECIST1Point1> tumorAssessmentRepository,
|
||||
|
@ -107,7 +104,6 @@ namespace IRaCIS.Application.Services
|
|||
IRepository<ReadingQuestionTrial> readingQuestionTrialRepository
|
||||
)
|
||||
{
|
||||
base._mapper = mapper;
|
||||
this._noneDicomStudyRepository = noneDicomStudyRepository;
|
||||
this._visitTaskRepository = visitTaskRepository;
|
||||
this._trialRepository = TrialRepository;
|
||||
|
@ -144,7 +140,6 @@ namespace IRaCIS.Application.Services
|
|||
this._readingQuestionSystem = ReadingQuestionSystem;
|
||||
this._noneDicomStudyFileSystem = noneDicomStudyFileSystem;
|
||||
this._readingQuestionTrialRepository = readingQuestionTrialRepository;
|
||||
this._cache = cache;
|
||||
this._trialEmailNoticeConfigService = trialEmailNoticeConfigService;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue