wms电梯设定,新增开关电梯控制接口

This commit is contained in:
yang.lee
2023-11-30 15:25:44 +08:00
parent 0fbc485cc3
commit 08888ac4c2
11 changed files with 150 additions and 66 deletions

View File

@@ -20,6 +20,7 @@ namespace JNPF.API.Entry;
public class Startup : AppStartup
{
//private TimedTaskBackgroundService timedTaskSvc = new();
public void ConfigureServices(IServiceCollection services)
{
// 注册和配置Mvc和api服务
@@ -48,7 +49,7 @@ public class Startup : AppStartup
services.AddMemoryCache(); // 使用本地缓存必须添加
services.AddConfigurableOptions<CacheOptions>();
services.AddSingleton( typeof(ISingleton), typeof(RedisData));
services.AddSingleton(typeof(ISingleton), typeof(RedisData));
// 微信
services.AddSenparcGlobalServices(App.Configuration) // Senparc.CO2NET 全局注册
.AddSenparcWeixinServices(App.Configuration); // Senparc.Weixin 注册如果使用Senparc.Weixin SDK则添加
@@ -56,15 +57,18 @@ public class Startup : AppStartup
services.AddOverideVisualDev();
//定时任务
services.AddHostedService<TimedTaskBackgroundService>();
//services.AddHostedService<RedisBackGround>();
services.AddHostedService<TimedTaskBackgroundService>();
services.AddSingleton<BackgroundService, TimedTaskBackgroundService>(sp => new TimedTaskBackgroundService());
//var bgSvc = App.GetRequiredService<BackgroundService>();
//bgSvc.StartAsync(CancellationToken.None);
//services.AddHostedService<RedisBackGround>();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting)
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IServiceProvider serviceProvider, IOptions<SenparcSetting> senparcSetting, IOptions<SenparcWeixinSetting> senparcWeixinSetting, IHostApplicationLifetime lifeTime)
{
// 添加状态码拦截中间件
app.UseUnifyResultStatusCodes();
@@ -113,5 +117,10 @@ public class Startup : AppStartup
bool isStartTimeJob = App.GetConfig<bool>("IsStartTimeJob");
if (isStartTimeJob)
serviceProvider.GetRequiredService<ITimeTaskService>().StartTimerJob();
}
}