feat: register points rule services
This commit is contained in:
parent
2574634459
commit
8cc1638d76
@ -19,6 +19,11 @@ using Newtonsoft.Json;
|
|||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
using Refit;
|
using Refit;
|
||||||
using NetCorePal.Extensions.CodeAnalysis;
|
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()
|
Log.Logger = new LoggerConfiguration()
|
||||||
.Enrich.WithClientIp()
|
.Enrich.WithClientIp()
|
||||||
@ -177,6 +182,14 @@ try
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Points Rule Services
|
||||||
|
|
||||||
|
builder.Services.AddScoped<IPointsRuleRepository, PointsRuleRepository>();
|
||||||
|
builder.Services.AddScoped<IPointsRuleConditionRepository, PointsRuleConditionRepository>();
|
||||||
|
builder.Services.AddScoped<PointsRuleMatcher>();
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
@ -212,8 +225,6 @@ try
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
app.UseHttpMetrics();
|
|
||||||
app.MapHealthChecks("/health");
|
|
||||||
app.MapMetrics(); // 通过 /metrics 访问指标
|
app.MapMetrics(); // 通过 /metrics 访问指标
|
||||||
|
|
||||||
// Code analysis endpoint
|
// Code analysis endpoint
|
||||||
@ -226,7 +237,13 @@ try
|
|||||||
return Results.Content(html, "text/html; charset=utf-8");
|
return Results.Content(html, "text/html; charset=utf-8");
|
||||||
});
|
});
|
||||||
|
|
||||||
app.UseHangfireDashboard();
|
app.UseHangfireDashboard("/hangfire");
|
||||||
|
|
||||||
|
RecurringJob.AddOrUpdate<IMediator>(
|
||||||
|
"process-expired-points-daily",
|
||||||
|
mediator => mediator.Send(new ProcessExpiredPointsCommand(1000), CancellationToken.None),
|
||||||
|
"0 2 * * *");
|
||||||
|
|
||||||
await app.RunAsync();
|
await app.RunAsync();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user