bgService 開啟停車場 API 讀取服務

This commit is contained in:
jiahao 2023-09-27 18:44:42 +08:00
parent 919130d94f
commit a368396189
2 changed files with 8 additions and 8 deletions

View File

@ -122,10 +122,10 @@ namespace BackendWorkerService
//#endregion
//#region 停車場管理(設定每 5秒 執行一次)
//services.AddSingleton<ParkingJob>();
//services.AddSingleton(
//new JobSchedule(jobType: typeof(ParkingJob), cronExpression: configuration.GetValue<string>("BackgroundServiceCron:ParkingJob"))
//);
services.AddSingleton<ParkingJob>();
services.AddSingleton(
new JobSchedule(jobType: typeof(ParkingJob), cronExpression: configuration.GetValue<string>("BackgroundServiceCron:ParkingJob"))
);
//#endregion
//#region 電錶歸檔(設定每 小時 執行一次)

View File

@ -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<object>();
@ -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);