diff --git a/src/Fengling.Member.Web/Program.cs b/src/Fengling.Member.Web/Program.cs index 3974c51..a5ba02c 100644 --- a/src/Fengling.Member.Web/Program.cs +++ b/src/Fengling.Member.Web/Program.cs @@ -19,6 +19,11 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; using Refit; using NetCorePal.Extensions.CodeAnalysis; +using Fengling.Member.Infrastructure.Repositories; +using Fengling.Member.Application.Services; +using Fengling.Member.Application.Commands.Points; +using Fengling.Member.Web.Endpoints.v1; +using Fengling.Member.Domain.Repositories; Log.Logger = new LoggerConfiguration() .Enrich.WithClientIp() @@ -177,6 +182,14 @@ try #endregion + #region Points Rule Services + + builder.Services.AddScoped(); + builder.Services.AddScoped(); + builder.Services.AddScoped(); + + #endregion + var app = builder.Build(); @@ -212,8 +225,6 @@ try #endregion - app.UseHttpMetrics(); - app.MapHealthChecks("/health"); app.MapMetrics(); // 通过 /metrics 访问指标 // Code analysis endpoint @@ -226,7 +237,13 @@ try return Results.Content(html, "text/html; charset=utf-8"); }); - app.UseHangfireDashboard(); + app.UseHangfireDashboard("/hangfire"); + + RecurringJob.AddOrUpdate( + "process-expired-points-daily", + mediator => mediator.Send(new ProcessExpiredPointsCommand(1000), CancellationToken.None), + "0 2 * * *"); + await app.RunAsync(); } catch (Exception ex)