Browse Source

update

master
mahao 1 year ago
parent
commit
87ca623477
  1. 14
      code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

14
code/src/Modules/SettleAccount/host/SettleAccount.HttpApi.Host/Startup.cs

@ -1,4 +1,5 @@
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using Coravel;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.ApplicationModels; using Microsoft.AspNetCore.Mvc.ApplicationModels;
@ -21,9 +22,13 @@ public class Startup
JobHostdService.AddService(services); JobHostdService.AddService(services);
services.AddSingleton<JobHostdService>(); services.AddSingleton<JobHostdService>();
services.AddHostedService(o => o.GetRequiredService<JobHostdService>()); services.AddHostedService(o => o.GetRequiredService<JobHostdService>());
services.AddScheduler();
services.AddTransient<HBPOSeSyncAppService>(); services.AddTransient<HBPOSeSyncAppService>();
services.AddTransient<BBACSeSyncAppService>(); services.AddTransient<BBACSeSyncAppService>();
services.AddTransient<ZhiGongBBACSeSyncAppService>(); services.AddTransient<ZhiGongBBACSeSyncAppService>();
services.AddTransient<ZhiGongHBPOSeSyncAppService>();
services.AddTransient<BeiSeSyncAppService>();
services.AddTransient<YinDuSeSyncAppService>();
services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer)); services.AddRouting(options => options.ConstraintMap["slugify"] = typeof(SlugifyParameterTransformer));
services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer()))); services.AddMvc(options => options.Conventions.Add(new RouteTokenTransformerConvention(new SlugifyParameterTransformer())));
services.AddApplication<SettleAccountHttpApiHostModule>(); services.AddApplication<SettleAccountHttpApiHostModule>();
@ -44,6 +49,15 @@ public class Startup
{ {
app.UseRouting(); app.UseRouting();
app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub")); app.UseEndpoints(endpoints => endpoints.MapHub<PageHub>("/api/hub"));
app.ApplicationServices.UseScheduler(scheduler =>
{
//scheduler.Schedule<HBPOSeSyncAppService>().EveryMinute();
//scheduler.Schedule<BBACSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongBBACSeSyncAppService>().EveryMinute();
scheduler.Schedule<ZhiGongHBPOSeSyncAppService>().EveryMinute();
scheduler.Schedule<BeiSeSyncAppService>().EveryMinute();
scheduler.Schedule<YinDuSeSyncAppService>().EveryMinute();
});
var contentTypeProvider = new FileExtensionContentTypeProvider(); var contentTypeProvider = new FileExtensionContentTypeProvider();
contentTypeProvider.Mappings.Add(".mjs", "text/javascript"); contentTypeProvider.Mappings.Add(".mjs", "text/javascript");
app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider }); app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = contentTypeProvider });

Loading…
Cancel
Save