From a368396189c2e6e4df18055c8d8f4b1bfa861607 Mon Sep 17 00:00:00 2001 From: jiahao Date: Wed, 27 Sep 2023 18:44:42 +0800 Subject: [PATCH] =?UTF-8?q?bgService=20=E9=96=8B=E5=95=9F=E5=81=9C?= =?UTF-8?q?=E8=BB=8A=E5=A0=B4=20API=20=E8=AE=80=E5=8F=96=E6=9C=8D=E5=8B=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackendWorkerService/Program.cs | 8 ++++---- BackendWorkerService/Quartz/Jobs/ParkingJob.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/BackendWorkerService/Program.cs b/BackendWorkerService/Program.cs index e293df7..83bb120 100644 --- a/BackendWorkerService/Program.cs +++ b/BackendWorkerService/Program.cs @@ -122,10 +122,10 @@ namespace BackendWorkerService //#endregion //#region 停車場管理(設定每 5秒 執行一次) - //services.AddSingleton(); - //services.AddSingleton( - //new JobSchedule(jobType: typeof(ParkingJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ParkingJob")) - //); + services.AddSingleton(); + services.AddSingleton( + new JobSchedule(jobType: typeof(ParkingJob), cronExpression: configuration.GetValue("BackgroundServiceCron:ParkingJob")) + ); //#endregion //#region 電錶歸檔(設定每 小時 執行一次) diff --git a/BackendWorkerService/Quartz/Jobs/ParkingJob.cs b/BackendWorkerService/Quartz/Jobs/ParkingJob.cs index 4391508..61251cf 100644 --- a/BackendWorkerService/Quartz/Jobs/ParkingJob.cs +++ b/BackendWorkerService/Quartz/Jobs/ParkingJob.cs @@ -95,7 +95,7 @@ namespace BackendWorkerService.Quartz.Jobs { var tagName = selectedMapping.system_value; var apiFormat = @"{0}obix/config/Arena/{1}/{2}/{3}/{4}/{5}/CV/set"; - + var tagNameSplit = tagName.Split("_"); var parames = new List(); @@ -104,14 +104,14 @@ namespace BackendWorkerService.Quartz.Jobs { if (i != tagNameSplit.Length - 1) { - parames.Add(tagNameSplit[i]); + parames.Add(tagNameSplit[i]); // tag 4畾 } else { - parames.Add(tagName); + parames.Add(tagName); // 蝚砌畾 摰 tag } } - + logger.LogError(@$"ParkingJob頠游拚頠雿{apiFormat}"); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format(apiFormat, parames.ToArray())); request.Method = "POST"; request.Headers.Add("Authorization", "Basic " + encoded);