| | |
| | | using System.Text; |
| | | using HDL_ON.Entity; |
| | | using RestSharp; |
| | | using Shared; |
| | | |
| | | namespace HDL_ON.DAL.Server |
| | | { |
| | |
| | | RestRequest request = new RestRequest(method); |
| | | request.Timeout = mTimeout * 1000; |
| | | request.AddHeader("content-type", "application/json"); |
| | | request.AddHeader("language", Language.CurrentLanguage == "Chinese" ? "cn" : "en");//增加语言标识 wxr 2023-03-22 17:03:34 |
| | | |
| | | if (string.IsNullOrEmpty(replaceToken)) |
| | | { |
| | |
| | | { |
| | | request.AddHeader("Authorization", replaceToken); |
| | | } |
| | | |
| | | |
| | | if (bodyParameterJson != null) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | HDL_ON.Utlis.WriteLine($"接口异常:{requestFullUrl} \r\n"+response.ErrorMessage); |
| | | HDL_ON.Utlis.WriteLine($"接口异常:{requestFullUrl} \r\n"+response.Content); |
| | | if(response.Content!= null) |
| | | { |
| | | try |
| | | { |
| | | var pack = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content); |
| | | if (pack != null) |
| | | { |
| | | return pack; |
| | | } |
| | | } |
| | | catch { } |
| | | } |
| | | return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR }; |
| | | } |
| | | |