@@ -40,6 +40,7 @@ namespace HKCardOUT.Helper | |||||
} | } | ||||
public class ApiRoute | public class ApiRoute | ||||
{ | { | ||||
public static string GetTime = "http://192.168.1.22:5000/api/one-card/eat-time-interval"; | |||||
/// <summary> | /// <summary> | ||||
/// 获取所有卡 | /// 获取所有卡 | ||||
/// </summary> | /// </summary> | ||||
@@ -43,11 +43,14 @@ namespace HKCardOUT.Logic | |||||
/// </summary> | /// </summary> | ||||
public static void SyncTime() | 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 => | var data = IHttpMultiClient.HttpMulti.AddNode(t => | ||||
{ | { | ||||
t.NodePath = ApiRoute.CheckCardStatus; | |||||
t.NodePath = ApiRoute.GetTime; | |||||
t.ReqType = MultiType.GET; | t.ReqType = MultiType.GET; | ||||
}).Build().RunStringFirst().ToModel<JObject>()["data"]["data"]; | |||||
}).Build().RunStringFirst(); | |||||
} | } | ||||
@@ -38,6 +38,39 @@ namespace HKLib.Dto | |||||
public DateTime ATEndTime { get; set; } | public DateTime ATEndTime { get; set; } | ||||
} | } | ||||
public class TimeSpilteDto | |||||
{ | |||||
/// <summary> | |||||
/// 早上开始时间 | |||||
/// </summary> | |||||
public string AMStartTime { get; set; } | |||||
/// <summary> | |||||
/// 早上结束时间 | |||||
/// </summary> | |||||
public string AMEndTime { get; set; } | |||||
/// <summary> | |||||
/// 中午开始时间 | |||||
/// </summary> | |||||
public string PMStartTime { get; set; } | |||||
/// <summary> | |||||
/// 中午结束时间 | |||||
/// </summary> | |||||
public string PMEndTime { get; set; } | |||||
/// <summary> | |||||
/// 晚上开始时间 | |||||
/// </summary> | |||||
public string ATStartTime { get; set; } | |||||
/// <summary> | |||||
/// 晚上结束时间 | |||||
/// </summary> | |||||
public string ATEndTime { get; set; } | |||||
} | |||||
} | } |
@@ -20,14 +20,25 @@ namespace HKLib.Interfaces | |||||
/// </summary> | /// </summary> | ||||
public static bool SetTime(TimeSpilte input) | 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) | .AddHeader(t => t.Headers = Header) | ||||
.AddNode(t => | .AddNode(t => | ||||
{ | { | ||||
t.NodePath = $"{Configer.SaasRoute}"; | |||||
t.JsonParam = input.ToJson(); | |||||
t.ReqType = MultiType.POST; | |||||
}).Build().RunStringFirst().ToModel<JObject>()["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<JObject>()["data"]["isSuccess"].ToString().AsBool(); | |||||
} | } | ||||
/// <summary> | /// <summary> | ||||