From d4973876384be55df64de45db8a511d1e0330872 Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期三, 23 六月 2021 17:06:20 +0800
Subject: [PATCH] 房间小图列表
---
HDL_ON/DAL/Server/HttpUtil.cs | 71 +++++++++++++++++++++++++----------
1 files changed, 50 insertions(+), 21 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs
index 512e33b..32c87e1 100644
--- a/HDL_ON/DAL/Server/HttpUtil.cs
+++ b/HDL_ON/DAL/Server/HttpUtil.cs
@@ -13,10 +13,13 @@
{
#region **********鍏ㄥ眬甯搁噺**********
- ///// <summary>
- ///// API_HTTPS
- ///// </summary>
- //public const string API_HTTPS = "https://";
+ /// <summary>
+ /// 鍥哄畾鍩熷悕,姝e紡鐜
+ /// 鍏叡鍩熷悕灏辫繎瑙f瀽
+ ///
+ /// </summary>
+ public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
+ //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";//mmmm
/// <summary>
/// RegionMark
/// </summary>
@@ -37,11 +40,6 @@
#endregion
#region **********缃戠粶璇锋眰灏佽**********
- /// <summary>
- /// 鍥哄畾鍩熷悕,姝e紡鐜
- /// </summary>
- //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
- public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
/// <summary>
/// Get 璇锋眰鏈嶅姟鍣ㄦ柟娉�
@@ -148,6 +146,12 @@
/// <returns></returns>
static ResponsePackNew RequestHttpsBase(Method method, string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 10)
{
+ //Dome妯″紡鐧诲綍
+
+ if(MainPage.NoLoginMode)
+ {
+ return new ResponsePackNew() { Code = "0" };
+ }
#region HttpWebRequest
try
{
@@ -212,7 +216,7 @@
//*****涓�浜涘垽绌哄鐞�*****************
if (revertObj.Code == null)
{
- revertObj.Code = "DATA_EXCEPTION";
+ revertObj.Code = StateCode.DATA_EXCEPTION;
}
if (revertObj.Data == null)
@@ -226,20 +230,20 @@
catch (Exception ex)
{
HDL_ON.Utlis.WriteLine(ex.Message);
- return new ResponsePackNew() { Code = "DATA_EXCEPTION" };
+ return new ResponsePackNew() { Code = StateCode.DATA_EXCEPTION };
}
}
else
{
HDL_ON.Utlis.WriteLine(response.Content);
- return new ResponsePackNew() { Code = "NETWORK_ERROR" };
+ return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR };
}
}
catch (Exception ex)
{
HDL_ON.Utlis.WriteLine(ex.Message);
- return new ResponsePackNew() { Code = "NETWORK_ERROR" };
+ return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR };
}
#endregion
@@ -453,7 +457,7 @@
revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content);
if (revertObj.Code == null)
{
- revertObj.Code = "DATA_EXCEPTION";
+ revertObj.Code = StateCode.DATA_EXCEPTION;
}
////缁熶竴杞垚澶у啓
//revertObj.StateCode = revertObj.StateCode.ToUpper ();
@@ -462,20 +466,20 @@
catch (Exception ex)
{
HDL_ON.Utlis.WriteLine(ex.Message);
- return new ResponsePackNew() { Code = "DATA_EXCEPTION" };
+ return new ResponsePackNew() { Code = StateCode.DATA_EXCEPTION };
}
}
else
{
HDL_ON.Utlis.WriteLine(response.Content);
- return new ResponsePackNew() { Code = "NETWORK_ERROR" };
+ return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR };
}
}
catch (Exception ex)
{
HDL_ON.Utlis.WriteLine(ex.Message);
- return new ResponsePackNew() { Code = "NETWORK_ERROR" };
+ return new ResponsePackNew() { Code = StateCode.NETWORK_ERROR };
}
#endregion
@@ -551,19 +555,36 @@
}
return signstr.ToLower();
}
-
+ /// <summary>
+ /// 鍒ゆ柇褰撳墠鍊兼槸鍚﹂渶瑕佸弬涓庣鍚嶏紝淇濇寔璺熶簯绔竴鑷�
+ /// 绌哄瓧绗︿覆涓嶅弬涓�
+ /// 鏁扮粍,闆嗗悎,瀵硅薄涓嶅弬涓�
+ /// </summary>
+ /// <param name="valueStr"></param>
+ /// <returns></returns>
+ static bool IfValueNeedSign(string valueStr)
+ {
+ if (string.IsNullOrEmpty(valueStr) || valueStr.StartsWith("{") || valueStr.StartsWith("["))
+ {
+ return false;
+ }
+ return true;
+ }
/// <summary>
/// 2020-11-02
/// 鍩虹鏈嶅姟鐨勬帴鍙i兘瑕佹牎楠宻ign
/// 璁$畻sign绛惧悕
/// </summary>
/// <returns></returns>
- public static string GetSignRequestJson(object requestObj)
+ public static string GetSignRequestJson(object requestObj,Dictionary<string,object> paramDictionary = null)
{
try
{
//1. 灏唌odel瀹炰綋杞负Dictionary<string, object>
- var paramDictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(Newtonsoft.Json.JsonConvert.SerializeObject(requestObj));
+ if (paramDictionary == null)
+ {
+ paramDictionary = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(Newtonsoft.Json.JsonConvert.SerializeObject(requestObj));
+ }
//2. 璁$畻sign
if (paramDictionary != null)
{
@@ -579,7 +600,10 @@
if (item.Value != null)
{
//Value.ToString()涓簄ull鎴栬��""涔熶笉鍙傚姞鏍¢獙
- if (!string.IsNullOrEmpty(item.Value.ToString()))
+ //if (!string.IsNullOrEmpty(item.Value.ToString()) && (item.Value is string || item.Value.GetType().IsValueType))
+ //{
+ //妫�娴嬪綋鍓嶅弬鏁版槸鍚﹂渶瑕佸弬涓庢牎楠�
+ if (IfValueNeedSign(item.Value.ToString()))
{
//濡傛灉鏄痓ool绫诲瀷锛岃杞皬鍐�
if (item.Value is bool)
@@ -637,6 +661,11 @@
/// </summary>
public string message;
+ /// <summary>
+ /// 杩欎釜鏄姹傞敊璇椂鐨勬墿灞曟暟鎹�,浠ュ悗鎵�鏈夌殑闄勫甫鎵╁睍鏁版嵁閮戒細鏀惧湪杩欓噷闈㈠姩鎬佺淮鎶�
+ /// </summary>
+ public object extra;
+
///// <summary>
///// isSuccess
///// </summary>
--
Gitblit v1.8.0