From b393425166d2f702f888780175955062ed00b921 Mon Sep 17 00:00:00 2001 From: TianMaiCheng <746290578@qq.com> Date: Tue, 20 Jan 2026 10:19:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8A=A8=E6=80=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=90=84=E9=A1=B9=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BLW_Log/Controllers/ValuesController.cs | 12 +++++ BLW_Log/Program.cs | 14 ++--- BLW_Log/appsettings.json | 38 ++++++++------ BLW_Log/services/ShengJiCaoZuo.cs | 70 +++++++++++++++++-------- 4 files changed, 90 insertions(+), 44 deletions(-) diff --git a/BLW_Log/Controllers/ValuesController.cs b/BLW_Log/Controllers/ValuesController.cs index c8095d4..87b7648 100644 --- a/BLW_Log/Controllers/ValuesController.cs +++ b/BLW_Log/Controllers/ValuesController.cs @@ -10,6 +10,18 @@ namespace BLW_Log.Controllers [ApiController] public class ValuesController : ControllerBase { + public readonly IConfiguration configuration; + public ValuesController(IConfiguration _configuration) + { + configuration = _configuration; + } + + public string Get() + { + var timer_es = configuration["ShengJi:JianGe"]; + var RoomTypeID_FirstVersion = configuration["ShengJi:RoomTypeID_FirstVersion"]; + return timer_es; + } public string get_json(string data) { return data; diff --git a/BLW_Log/Program.cs b/BLW_Log/Program.cs index 910621f..a8bd738 100644 --- a/BLW_Log/Program.cs +++ b/BLW_Log/Program.cs @@ -176,13 +176,13 @@ namespace BLW_Log //ͣ - var jobKey5 = new JobKey("BuTingShengJi"); - q.AddJob(opts => opts.WithIdentity(jobKey5)); - q.AddTrigger(opts => opts - .ForJob(jobKey5) - .WithIdentity("BuTingShengJi-trigger") - .StartAt(DateTimeOffset.Now.AddMinutes(1)) - ); + //var jobKey5 = new JobKey("BuTingShengJi"); + //q.AddJob(opts => opts.WithIdentity(jobKey5)); + //q.AddTrigger(opts => opts + // .ForJob(jobKey5) + // .WithIdentity("BuTingShengJi-trigger") + // .StartAt(DateTimeOffset.Now.AddMinutes(1)) + //); }); builder.Services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true); diff --git a/BLW_Log/appsettings.json b/BLW_Log/appsettings.json index e7e1043..35114b5 100644 --- a/BLW_Log/appsettings.json +++ b/BLW_Log/appsettings.json @@ -1,18 +1,26 @@ { - "ConnectionStrings": { - "DefaultConnection": "Server=10.8.8.208;Database=postgres;user id=postgres;password=123456;port=16035;" - }, - "ExcelGenerater": "15,45,0", - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*", - "JwT": { - "SecretKey": "393bJJaBS%siAQ7U=dxk3&lb$0p3])r96=FU9-B.yp'8%'a.1wF64rkCv3$&2?^T3Vs]6z4u8j]*4NRTd418x8b6m4T04=hyn4>l0i-MB8Sy%h745GKN0~p3fMIaJav)", - "Issuer": "宝来威供应商系统", - "Audience": "W*u93xxp*08DnW@%6}5Tjh6bE?;hW" + "ConnectionStrings": { + "DefaultConnection": "Server=10.8.8.208;Database=postgres;user id=postgres;password=123456;port=16035;" + }, + "ExcelGenerater": "15,45,0", + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" } + }, + "AllowedHosts": "*", + "JwT": { + "SecretKey": "393bJJaBS%siAQ7U=dxk3&lb$0p3])r96=FU9-B.yp'8%'a.1wF64rkCv3$&2?^T3Vs]6z4u8j]*4NRTd418x8b6m4T04=hyn4>l0i-MB8Sy%h745GKN0~p3fMIaJav)", + "Issuer": "宝来威供应商系统", + "Audience": "W*u93xxp*08DnW@%6}5Tjh6bE?;hW" + }, + "ShengJi": { + "JianGe": "10", + "RoomTypeID_FirstVersion": "1412", + "First_GuJian_Name": "C1F_A_L4_31_240723_NM.bin", + "RoomTypeID_SecondVerrsion": "2438", + "Second_GuJian_Name": "C1F_A_L4_41_250605_NM.bin", + "HostIdList": "[24540]" + } } diff --git a/BLW_Log/services/ShengJiCaoZuo.cs b/BLW_Log/services/ShengJiCaoZuo.cs index 721aaa1..3e2fa58 100644 --- a/BLW_Log/services/ShengJiCaoZuo.cs +++ b/BLW_Log/services/ShengJiCaoZuo.cs @@ -9,29 +9,43 @@ namespace BLW_Log.services { public class ShengJiCaoZuoB : IJob { + public static int ShengJiCaoZuoBCount = 0; private readonly Logger _logger = LogManager.GetCurrentClassLogger(); - //public static string BaseUrl = "https://www.boonlive-rcu.com/"; private readonly Dictionary _clients; - public ShengJiCaoZuoB(Dictionary clients) + private readonly IConfiguration configuration; + + public ShengJiCaoZuoB(Dictionary clients, IConfiguration configuration) { _clients = clients; + this.configuration = configuration; } async public Task Execute(IJobExecutionContext context) { try { + var timer_es = configuration["ShengJi:JianGe"]; + var RoomTypeID_FirstVersion = configuration["ShengJi:RoomTypeID_FirstVersion"]; + var First_GuJian_Name = configuration["ShengJi:First_GuJian_Name"]; + var RoomTypeID_SecondVerrsion = configuration["ShengJi:RoomTypeID_SecondVerrsion"]; + var Second_GuJian_Name = configuration["ShengJi:Second_GuJian_Name"]; + var HostIdList = configuration["ShengJi:HostIdList"]; + int jiange = int.Parse(timer_es); - //var options = new RestClientOptions(BaseUrl); var client = _clients["NoStopShengJi"]; string Url = "api/WebChatUpgrade"; var request = new RestRequest(Url); //2438 //研发测试房型_1 //固件:BLV-C5 || Launcher_C1F_V04 || C1F_A_L4_41_250605_NM.bin - request.AddParameter("roomTypeID", "2438"); - request.AddParameter("hostid_lists", "[24540]"); - request.AddParameter("upgradefileName", "C1F_A_L4_41_250605_NM.bin"); + //request.AddParameter("roomTypeID", "2438"); + //request.AddParameter("hostid_lists", "[24540]"); + //request.AddParameter("upgradefileName", "C1F_A_L4_41_250605_NM.bin"); + + request.AddParameter("roomTypeID", RoomTypeID_SecondVerrsion); + request.AddParameter("hostid_lists", HostIdList); + request.AddParameter("upgradefileName", Second_GuJian_Name); + _logger.Error("ShengJiCaoZuo 研发测试房型_1 开始:"); var response = await client.ExecutePostAsync(request); _logger.Error("ShengJiCaoZuo 研发测试房型_1 执行结果:" + response.Content); @@ -43,7 +57,7 @@ namespace BLW_Log.services // 直接启动JobA var jobA = JobBuilder.Create().Build(); var triggerA = TriggerBuilder.Create() - .StartAt(DateTimeOffset.Now.AddMinutes(10)) + .StartAt(DateTimeOffset.Now.AddMinutes(jiange)) .Build(); await context.Scheduler.ScheduleJob(jobA, triggerA); @@ -51,12 +65,12 @@ namespace BLW_Log.services else { // 直接启动JobB - var jobA = JobBuilder.Create().Build(); - var triggerA = TriggerBuilder.Create() - .StartAt(DateTimeOffset.Now.AddMinutes(10)) + var jobB = JobBuilder.Create().Build(); + var triggerB = TriggerBuilder.Create() + .StartAt(DateTimeOffset.Now.AddMinutes(jiange)) .Build(); - await context.Scheduler.ScheduleJob(jobA, triggerA); + await context.Scheduler.ScheduleJob(jobB, triggerB); } } catch (Exception ex) @@ -64,25 +78,32 @@ namespace BLW_Log.services _logger.Error("ShengJiCaoZuoB 执行失败:" + ex.Message); } } - public static int ShengJiCaoZuoBCount = 0; } public class ShengJiCaoZuoA : IJob { - public static int ShengJiCaoZuoACount = 0; private readonly Logger _logger = LogManager.GetCurrentClassLogger(); + public readonly IConfiguration configuration; private readonly Dictionary _clients; - public ShengJiCaoZuoA(Dictionary clients) + public ShengJiCaoZuoA(Dictionary clients, IConfiguration _configuration) { _clients = clients; + this.configuration = _configuration; } - //public static string BaseUrl = "https://www.boonlive-rcu.com/"; public async Task Execute(IJobExecutionContext context) { try { - //var options = new RestClientOptions(BaseUrl); + + var timer_es = configuration["ShengJi:JianGe"]; + var RoomTypeID_FirstVersion = configuration["ShengJi:RoomTypeID_FirstVersion"]; + var First_GuJian_Name = configuration["ShengJi:First_GuJian_Name"]; + var RoomTypeID_SecondVerrsion = configuration["ShengJi:RoomTypeID_SecondVerrsion"]; + var Second_GuJian_Name = configuration["ShengJi:Second_GuJian_Name"]; + var HostIdList = configuration["ShengJi:HostIdList"]; + int jiange = int.Parse(timer_es); + var client = _clients["NoStopShengJi"]; string Url = "api/WebChatUpgrade"; var request = new RestRequest(Url); @@ -96,20 +117,25 @@ namespace BLW_Log.services //2438 //研发测试房型_1 //固件:BLV-C5 || Launcher_C1F_V04 || C1F_A_L4_41_250605_NM.bin - request.AddParameter("roomTypeID", "1412"); - request.AddParameter("hostid_lists", "[24540]"); - request.AddParameter("upgradefileName", "C1F_A_L4_31_240723_NM.bin"); - _logger.Error("ShengJiCaoZuo YHF_T 开始:" ); + //request.AddParameter("roomTypeID", "1412"); + //request.AddParameter("hostid_lists", "[24540]"); + //request.AddParameter("upgradefileName", "C1F_A_L4_31_240723_NM.bin"); + + request.AddParameter("roomTypeID", RoomTypeID_FirstVersion); + request.AddParameter("hostid_lists", HostIdList); + request.AddParameter("upgradefileName", First_GuJian_Name); + _logger.Error("ShengJiCaoZuo YHF_T 开始:"); var response = await client.ExecutePostAsync(request); _logger.Error("ShengJiCaoZuo YHF_T 执行成功:" + response.Content); + ShengJiCaoZuoACount = ShengJiCaoZuoACount + 1; if (ShengJiCaoZuoACount >= 2) { var jobB = JobBuilder.Create().Build(); var triggerB = TriggerBuilder.Create() - .StartAt(DateTimeOffset.Now.AddMinutes(10)) + .StartAt(DateTimeOffset.Now.AddMinutes(jiange)) .Build(); await context.Scheduler.ScheduleJob(jobB, triggerB); @@ -118,7 +144,7 @@ namespace BLW_Log.services { var jobA = JobBuilder.Create().Build(); var triggerA = TriggerBuilder.Create() - .StartAt(DateTimeOffset.Now.AddMinutes(10)) + .StartAt(DateTimeOffset.Now.AddMinutes(jiange)) .Build(); await context.Scheduler.ScheduleJob(jobA, triggerA); }