diff --git a/HKCardOUT/HKCardOUT.csproj b/HKCardOUT/HKCardOUT.csproj index da2f7f7..9b089da 100644 --- a/HKCardOUT/HKCardOUT.csproj +++ b/HKCardOUT/HKCardOUT.csproj @@ -14,9 +14,9 @@ 1.0.0.0 AnyCPU;x86 - + TRACE;Core diff --git a/HKCardOUT/Logic/RemoteService.cs b/HKCardOUT/Logic/RemoteService.cs index 44a0e2c..39f123c 100644 --- a/HKCardOUT/Logic/RemoteService.cs +++ b/HKCardOUT/Logic/RemoteService.cs @@ -56,9 +56,19 @@ namespace HKCardOUT.Logic t.NodePath = ApiRoute.GetTime; t.ReqType = MultiType.GET; }).Build().RunStringFirst(); - DataBus.Times = data.ToModel()["data"]["data"].ToJson().ToModel(); + var dtoTime = data.ToModel()["data"]["data"].ToJson().ToModel(); + var time = GetNetWorkTime(); + var tims = $"{time.Year}-{time.Month}-{time.Day}"; + DataBus.Times = new TimeSpilte(); + DataBus.Times.AMStartTime = DateTime.Parse($"{tims} {dtoTime.AMStartTime}"); + DataBus.Times.AMEndTime = DateTime.Parse($"{tims} {dtoTime.AMEndTime}"); + DataBus.Times.PMStartTime = DateTime.Parse($"{tims} {dtoTime.PMStartTime}"); + DataBus.Times.PMEndTime = DateTime.Parse($"{tims} {dtoTime.PMEndTime}"); + DataBus.Times.ATStartTime = DateTime.Parse($"{tims} {dtoTime.ATStartTime}"); + DataBus.Times.ATEndTime = DateTime.Parse($"{tims} {dtoTime.ATEndTime}"); + HKLogImport.WriteInfo("同步时间:" + DataBus.Times); - + } /// @@ -99,7 +109,7 @@ namespace HKCardOUT.Logic { var Ids = dto.Select(t => t.Id).ToList(); var check = DbContext.Context.Queryable().Where(t => Ids.Contains(t.Id)).Any(t => t.IsSync); - if (check) return null ; + if (check) return null; var data = IHttpMultiClient.HttpMulti.AddHeader(t => { t.HeaderKey = "TenantId"; @@ -178,7 +188,8 @@ namespace HKCardOUT.Logic /// /// 获取网络服务器时间 /// - public static DateTime GetNetWorkTime() { + public static DateTime GetNetWorkTime() + { HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.baidu.com"); request.Method = "HEAD";