From 8c1bf42c5fca66625b59728006bd47bae0b6a3ad Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期一, 23 十一月 2020 10:18:16 +0800 Subject: [PATCH] Revert "Merge branch 'CJL' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into CJL" --- HDL_ON/DAL/Server/HttpUtil.cs | 51 +++++++++++++++++++++++++++++++++------------------ 1 files changed, 33 insertions(+), 18 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index c36697b..b0af7fb 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -152,8 +152,9 @@ try { - //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = APIInfoConfig.Current.RequestHttpsHost; + //if (string.IsNullOrEmpty(urlHead)) + //{ + // urlHead = UserInfo.Current.RequestHttpsHost; //} //string requestFullUrl = urlHead + apiPath; @@ -171,9 +172,9 @@ if (string.IsNullOrEmpty(replaceToken)) { - if (MainPage.LoginUser != null) + if(UserInfo.Current != null) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - request.AddHeader("Authorization", MainPage.LoginUser.loginTokenString); + request.AddHeader("Authorization", UserInfo.Current.loginTokenString); } } else @@ -227,20 +228,20 @@ } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "DATA_EXCEPTION" }; } } else { - HDL_ON.Common.Utlis.WriteLine(response.Content); + HDL_ON.Utlis.WriteLine(response.Content); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } @@ -264,7 +265,7 @@ try { //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = APIInfoConfig.Current.RequestHttpsHost; + // urlHead = UserInfo.Current.RequestHttpsHost; //} //string requestFullUrl = urlHead + apiPath; @@ -280,9 +281,9 @@ if (string.IsNullOrEmpty(replaceToken)) { - if (MainPage.LoginUser != null) + if ( UserInfo.Current != null) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - request.AddHeader("Authorization", MainPage.LoginUser.loginTokenString); + request.AddHeader("Authorization", UserInfo.Current.loginTokenString); } } else @@ -308,7 +309,7 @@ } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return null; } #endregion @@ -334,7 +335,7 @@ { //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = APIInfoConfig.Current.RequestHttpsHost; + // urlHead = UserInfo.Current.RequestHttpsHost; //} //string requestFullUrl = urlHead + apiPath; @@ -351,9 +352,9 @@ if (string.IsNullOrEmpty(replaceToken)) { - if (MainPage.LoginUser != null) + if ( UserInfo.Current != null) {/* 濡傛灉涓嶉渶瑕侀獙璇乀oken鍙互涓嶇敤浼犲叆 */ - request.AddHeader("Authorization", MainPage.LoginUser.loginTokenString); + request.AddHeader("Authorization", UserInfo.Current.loginTokenString); } } else @@ -399,20 +400,20 @@ } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "DATA_EXCEPTION" }; } } else { - HDL_ON.Common.Utlis.WriteLine(response.Content); + HDL_ON.Utlis.WriteLine(response.Content); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } } catch (Exception ex) { - HDL_ON.Common.Utlis.WriteLine(ex.Message); + HDL_ON.Utlis.WriteLine(ex.Message); return new ResponsePackNew() { Code = "NETWORK_ERROR" }; } @@ -478,11 +479,25 @@ string str = string.Empty; foreach (KeyValuePair<string, object> item in paramDictionary) { + //Value涓簄ull涓嶅弬鍔犳牎楠� if (item.Value != null) { - str += item.Key + "=" + item.Value.ToString() + "&"; + //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() + "&"; + } + } } } + //2.3 鎷兼帴SECRET_KEY str = str.Substring(0, str.Length - 1) + SECRET_KEY; //2.4 MD5杞崲+杞皬鍐� -- Gitblit v1.8.0