diff --git a/IRaCIS.Core.API/Progranm.cs b/IRaCIS.Core.API/Progranm.cs index 4aabde1ba..6d2307421 100644 --- a/IRaCIS.Core.API/Progranm.cs +++ b/IRaCIS.Core.API/Progranm.cs @@ -248,14 +248,16 @@ app.MapMasaMinimalAPIs(); // Serilog SerilogExtension.AddSerilogSetup(enviromentName, app.Services); -var hangfireJobService = app.Services.GetRequiredService(); - -await hangfireJobService.InitHangfireJobTaskAsync(); //设置国际化I18n var localizer = app.Services.GetRequiredService(); I18n.SetLocalizer(localizer); +var hangfireJobService = app.Services.GetRequiredService(); + +await hangfireJobService.InitHangfireJobTaskAsync(); + + try { #region 运行环境 部署平台 diff --git a/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs b/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs index 767c0a66e..05bb7c97f 100644 --- a/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs +++ b/IRaCIS.Core.Application/Helper/InternationalizationHelper.cs @@ -27,15 +27,15 @@ public static class InternationalizationHelper public static string USJsonPath = Path.Combine(JsonFileFolder, StaticData.En_US_Json); public static string CNJsonPath = Path.Combine(JsonFileFolder, StaticData.Zh_CN_Json); - //static InternationalizationHelper() - //{ - // if (!Directory.Exists(JsonFileFolder) || - // !Directory.GetFiles(JsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase))|| - // !File.Exists(USJsonPath) || !File.Exists(CNJsonPath)) - // { - // throw new BusinessValidationFailedException(I18n.T("IRaCISCHangfireJob_FileNotFound")); - // } - //} + static InternationalizationHelper() + { + if (!Directory.Exists(JsonFileFolder) || + !Directory.GetFiles(JsonFileFolder).Any(filePath => Path.GetExtension(filePath).Equals(".json", StringComparison.OrdinalIgnoreCase)) || + !File.Exists(USJsonPath) || !File.Exists(CNJsonPath)) + { + throw new BusinessValidationFailedException(I18n.T("IRaCISCHangfireJob_FileNotFound")); + } + } diff --git a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj index eb12535aa..9c039cd04 100644 --- a/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj +++ b/IRaCIS.Core.Application/IRaCIS.Core.Application.csproj @@ -27,6 +27,7 @@ + @@ -40,6 +41,9 @@ true PreserveNewest + + Always +