1212121
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Microsoft.OpenApi.Models;
|
||||
using Photon.Core.Redis;
|
||||
using Photon.Core.Timer;
|
||||
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
@@ -45,14 +46,19 @@ builder.Services.InjectJwt(builder.Configuration, new OpenApiInfo
|
||||
}, groups);
|
||||
|
||||
#endregion
|
||||
|
||||
//定时功能
|
||||
builder.Services.InjectTimer(services =>
|
||||
//自动程序
|
||||
string autoConfig = builder.Configuration["AutoProgram"]!;
|
||||
if (autoConfig == "1")
|
||||
{
|
||||
services.AddTransient<ITimerJobManager, TimerJobManager>();//注册管理器
|
||||
services.AddSingleton<AutoJob>();
|
||||
services.AddHostedService<JobStart>();
|
||||
});
|
||||
//定时功能
|
||||
builder.Services.InjectTimer(services =>
|
||||
{
|
||||
services.AddTransient<ITimerJobManager, TimerJobManager>();//注册管理器
|
||||
services.AddSingleton<AutoJob>();
|
||||
});
|
||||
builder.Services.AddHostedService<AppBackgroundService>();
|
||||
}
|
||||
|
||||
|
||||
//日志
|
||||
builder.Logging.InjectLog();
|
||||
|
||||
Reference in New Issue
Block a user