From 40eafbc0958b543fbb722f83bede2dbabdf50b38 Mon Sep 17 00:00:00 2001 From: xxe Date: Thu, 13 Oct 2022 17:41:03 +0800 Subject: [PATCH 1/2] 1 --- HKLib/Interfaces/HKLibHelper.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 586c125..0a0f510 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -165,9 +165,9 @@ namespace HKLib.Interfaces { t.NodePath = Route; t.ReqType = MultiType.POST; - t.JsonParam = input.ToJson(); - }).Build().RunStringFirst().ToModel()["data"]["data"].ToJson().ToModel>(); - return data; + t.JsonParam = (new { StartTime =input.StartTime.ToShortDateString(), EndTime=input.EndTime.ToShortDateString() }).ToJson(); + }).Build().RunStringFirst(); + return data.ToModel()["data"]["data"].ToJson().ToModel>(); } } } From 7e3fe34168c946ecfab48492b5a4d23b753d4f04 Mon Sep 17 00:00:00 2001 From: xxe Date: Thu, 13 Oct 2022 17:53:31 +0800 Subject: [PATCH 2/2] 1 --- HKCardOUT/Helper/DataBus.cs | 1 + HKCardOUT/Logic/RemoteService.cs | 7 +++++-- HKLib/Dto/TimeSpilte.cs | 33 ++++++++++++++++++++++++++++++++ HKLib/Interfaces/HKLibHelper.cs | 21 +++++++++++++++----- 4 files changed, 55 insertions(+), 7 deletions(-) diff --git a/HKCardOUT/Helper/DataBus.cs b/HKCardOUT/Helper/DataBus.cs index dd8585c..eea335a 100644 --- a/HKCardOUT/Helper/DataBus.cs +++ b/HKCardOUT/Helper/DataBus.cs @@ -40,6 +40,7 @@ namespace HKCardOUT.Helper } public class ApiRoute { + public static string GetTime = "http://192.168.1.22:5000/api/one-card/eat-time-interval"; /// /// 获取所有卡 /// diff --git a/HKCardOUT/Logic/RemoteService.cs b/HKCardOUT/Logic/RemoteService.cs index 6b613ad..9e302a3 100644 --- a/HKCardOUT/Logic/RemoteService.cs +++ b/HKCardOUT/Logic/RemoteService.cs @@ -43,11 +43,14 @@ namespace HKCardOUT.Logic /// public static void SyncTime() { + /* + {"statusCode":200,"data":{"isSuccess":true,"msg":null,"data":{"amStartTime":"17:50","amEndTime":"17:50","pmStartTime":"17:50","pmEndTime":"17:50","atStartTime":"17:50","atEndTime":"17:50"}},"succeeded":true,"errors":null,"extras":null,"timestamp":1665654784093} + */ var data = IHttpMultiClient.HttpMulti.AddNode(t => { - t.NodePath = ApiRoute.CheckCardStatus; + t.NodePath = ApiRoute.GetTime; t.ReqType = MultiType.GET; - }).Build().RunStringFirst().ToModel()["data"]["data"]; + }).Build().RunStringFirst(); } diff --git a/HKLib/Dto/TimeSpilte.cs b/HKLib/Dto/TimeSpilte.cs index d960c69..cfe6e94 100644 --- a/HKLib/Dto/TimeSpilte.cs +++ b/HKLib/Dto/TimeSpilte.cs @@ -38,6 +38,39 @@ namespace HKLib.Dto public DateTime ATEndTime { get; set; } } + public class TimeSpilteDto + { + + /// + /// 早上开始时间 + /// + public string AMStartTime { get; set; } + + /// + /// 早上结束时间 + /// + public string AMEndTime { get; set; } + + /// + /// 中午开始时间 + /// + public string PMStartTime { get; set; } + /// + /// 中午结束时间 + /// + public string PMEndTime { get; set; } + + /// + /// 晚上开始时间 + /// + public string ATStartTime { get; set; } + + /// + /// 晚上结束时间 + /// + public string ATEndTime { get; set; } + + } } diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 0a0f510..8d42b1f 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -20,14 +20,25 @@ namespace HKLib.Interfaces /// public static bool SetTime(TimeSpilte input) { - return IHttpMultiClient.HttpMulti + TimeSpilteDto dto = new TimeSpilteDto + { + AMEndTime = input.AMEndTime.ToShortTimeString(), + AMStartTime = input.AMStartTime.ToShortTimeString(), + PMEndTime = input.PMEndTime.ToShortTimeString(), + PMStartTime = input.PMStartTime.ToShortTimeString(), + ATEndTime = input.ATEndTime.ToShortTimeString(), + ATStartTime = input.ATStartTime.ToShortTimeString(), + }; + + var data = IHttpMultiClient.HttpMulti .AddHeader(t => t.Headers = Header) .AddNode(t => { - t.NodePath = $"{Configer.SaasRoute}"; - t.JsonParam = input.ToJson(); - t.ReqType = MultiType.POST; - }).Build().RunStringFirst().ToModel()["isSuccess"].ToString().AsBool(); + t.NodePath = $"{Configer.SaasRoute}api/one-card/eat-time-interval"; + t.JsonParam = dto.ToJson(); + t.ReqType = MultiType.PUT; + }).Build().RunStringFirst(); + return data.ToModel()["data"]["isSuccess"].ToString().AsBool(); } ///