From eb51679c618d5027070fbd6f3c0519f0f17e7d7d Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 23 十一月 2020 10:07:53 +0800 Subject: [PATCH] Merge branch 'CJL' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into CJL --- HDL_ON/DAL/Server/HttpUtil.cs | 53 +++++++++++++++++++++++++++++++---------------------- 1 files changed, 31 insertions(+), 22 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 154e4b3..c36697b 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -4,6 +4,7 @@ using System.Net; using System.Security.Cryptography; using System.Text; +using HDL_ON.Entity; using RestSharp; using Shared; @@ -11,6 +12,7 @@ { public class HttpUtil { + #region HttpUtil 鍏ㄥ眬甯搁噺 ///// <summary> ///// API_HTTPS @@ -80,6 +82,27 @@ // } // return mResponsePackNew; //} + + /// <summary> + /// POST璇锋眰鏂规硶 body鍙傛暟 + /// 閽堝浣忓畢鐩稿叧鎺ュ彛灏佽 + /// 璋冪敤浣忓畢褰撳墠鎵�鍦ㄥ尯鍩熷煙鍚� + /// 濡傛灉鏄垎浜綇瀹咃紝浣跨敤涓讳汉鐨則oken杩涜鐩稿叧鎿嶄綔 + /// </summary> + /// <param name="apiPath"></param> + /// <param name="bodyParameterJson"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + public static ResponsePackNew RequestHttpsPostFroHome(string apiPath, string bodyParameterJson, int mTimeout = 10) + { + string urlHead = DB_ResidenceData.residenceData.residecenInfo.regionUrl; + var replaceToken = ""; + if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare) + { + replaceToken = DB_ResidenceData.residenceData.MasterToken; + } + return RequestHttps(Method.POST, apiPath, bodyParameterJson, null, null, urlHead, replaceToken, mTimeout); + } /// <summary> /// POST璇锋眰鏂规硶 body鍙傛暟 @@ -204,20 +227,20 @@ } catch (Exception ex) { - HDL_ON.Utlis.WriteLine(ex.Message); + HDL_ON.Common.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "DATA_EXCEPTION" }; } } else { - HDL_ON.Utlis.WriteLine(response.Content); + HDL_ON.Common.Utlis.WriteLine(response.Content); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } } catch (Exception ex) { - HDL_ON.Utlis.WriteLine(ex.Message); + HDL_ON.Common.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } @@ -285,7 +308,7 @@ } catch (Exception ex) { - HDL_ON.Utlis.WriteLine(ex.Message); + HDL_ON.Common.Utlis.WriteLine(ex.Message); return null; } #endregion @@ -376,20 +399,20 @@ } catch (Exception ex) { - HDL_ON.Utlis.WriteLine(ex.Message); + HDL_ON.Common.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "DATA_EXCEPTION" }; } } else { - HDL_ON.Utlis.WriteLine(response.Content); + HDL_ON.Common.Utlis.WriteLine(response.Content); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } } catch (Exception ex) { - HDL_ON.Utlis.WriteLine(ex.Message); + HDL_ON.Common.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } @@ -455,25 +478,11 @@ string str = string.Empty; foreach (KeyValuePair<string, object> item in paramDictionary) { - //Value涓簄ull涓嶅弬鍔犳牎楠� if (item.Value != null) { - //Value.ToString()涓簄ull鎴栬��""涔熶笉鍙傚姞鏍¢獙 - if (!string.IsNullOrEmpty(item.Value.ToString())) - { - //濡傛灉鏄痓ool绫诲瀷锛岃杞皬鍐� - if (item.Value is bool) - { - str += item.Key + "=" + item.Value.ToString().ToLower() + "&"; - } - else - { - str += item.Key + "=" + item.Value.ToString() + "&"; - } - } + str += item.Key + "=" + item.Value.ToString() + "&"; } } - //2.3 鎷兼帴SECRET_KEY str = str.Substring(0, str.Length - 1) + SECRET_KEY; //2.4 MD5杞崲+杞皬鍐� -- Gitblit v1.8.0