var url = "http://11.4.64.77:8888/a/b";
if (url.StartsWith("https"))
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
foreach (var item in replyList)
{
try
{
HttpContent httpContent = new StringContent(JsonUtil.Stringify(new
{
flightId = item.FlightId,
userId = user.Id,
etd = item.ReplyStd,
isEtdNotice = item.Notice
}));
httpContent.Headers.ContentType = new MediaTypeHeaderValue("application/json");
httpContent.Headers.Add("APIKey", "jjj");
HttpClient httpClient = new HttpClient();
HttpResponseMessage response = httpClient.PostAsync(url, httpContent).Result;
if (response.IsSuccessStatusCode)
{
string result = response.Content.ReadAsStringAsync().Result;
item.SendFail = !(result != null && result.Contains("OK"));
}
}
catch (Exception)
{
item.SendFail = true;
}