private MiddleResult GetMiddleResult(HttpResponseMessage httpResponseMessage) { //将httpResponseMessage转换为MiddleResult HttpStatusCode status = httpResponseMessage.StatusCode; if (status.Equals(HttpStatusCode.OK) || status.Equals(HttpStatusCode.Created) || status.Equals(HttpStatusCode.Accepted)) { string httpJsonString = httpResponseMessage.Content.ReadAsStringAsync().Result; return(MiddleResult.JsonToMiddleResult(httpJsonString)); } else { throw new FrameException($"{HttpConst}服务调用错误:{httpResponseMessage.Content.ReadAsStringAsync()}"); } }
public static MiddleResult JsonToMiddleResult(string jsonStr) { MiddleResult result = JsonConvert.DeserializeObject <MiddleResult>(jsonStr); return(result); }