Bladeren bron

自启时间问题

master
xxe 2 jaren geleden
bovenliggende
commit
f01d4e796d
2 gewijzigde bestanden met toevoegingen van 17 en 6 verwijderingen
  1. +2
    -2
      HKCardOUT/HKCardOUT.csproj
  2. +15
    -4
      HKCardOUT/Logic/RemoteService.cs

+ 2
- 2
HKCardOUT/HKCardOUT.csproj Bestand weergeven

@@ -14,9 +14,9 @@
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
<PropertyGroup>
<!--<PropertyGroup>
<ApplicationManifest>App.manifest</ApplicationManifest>
</PropertyGroup>
</PropertyGroup>-->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>TRACE;Core</DefineConstants>
</PropertyGroup>


+ 15
- 4
HKCardOUT/Logic/RemoteService.cs Bestand weergeven

@@ -56,9 +56,19 @@ namespace HKCardOUT.Logic
t.NodePath = ApiRoute.GetTime;
t.ReqType = MultiType.GET;
}).Build().RunStringFirst();
DataBus.Times = data.ToModel<JObject>()["data"]["data"].ToJson().ToModel<TimeSpilte>();
var dtoTime = data.ToModel<JObject>()["data"]["data"].ToJson().ToModel<TimeSpilteDto>();
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);
}

/// <summary>
@@ -99,7 +109,7 @@ namespace HKCardOUT.Logic
{
var Ids = dto.Select(t => t.Id).ToList();
var check = DbContext.Context.Queryable<SaleLog>().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
/// <summary>
/// 获取网络服务器时间
/// </summary>
public static DateTime GetNetWorkTime() {
public static DateTime GetNetWorkTime()
{

HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://www.baidu.com");
request.Method = "HEAD";


Laden…
Annuleren
Opslaan