From 407fae6f07a2a982a2a814c2f145c40733c966cb Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期三, 12 一月 2022 15:29:34 +0800
Subject: [PATCH] 2022-01-12 1.更新
---
Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs | 84 +++++++++++++++++++++++++++++++-----------
1 files changed, 62 insertions(+), 22 deletions(-)
diff --git a/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs b/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs
index 2d8ec0d..e6c03af 100644
--- a/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs
+++ b/Crabtree/SmartHome/HDL/Common/HttpUtil/HttpUtil.cs
@@ -1,4 +1,10 @@
-锘縰sing System;
+锘�/**鍙戝竷鐜 浣跨敤鍙戝竷鐜 鍙戝竷鐨勬寮忕鍚岾EY**/
+#define Distribution
+
+///**娴嬭瘯鐜 浣跨敤娴嬭瘯鐜 浣跨敤娴嬭瘯鐨勭鍚岾EY**/
+//#undef Distribution
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
@@ -7,6 +13,8 @@
//using HDL_ON.Entity;
using RestSharp;
using Shared.SimpleControl;
+
+
namespace Shared
{
@@ -38,12 +46,42 @@
#endregion
#region **********缃戠粶璇锋眰灏佽**********
+
+
+
+
+#if Distribution
+ ///**********姝e紡鐜**********
/// <summary>
/// 鍥哄畾鍩熷悕,姝e紡鐜
/// 鍏叡鍩熷悕灏辫繎瑙f瀽
/// </summary>
- //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com";
- public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com";
+ public const string GlobalRequestHttpsHost = "https://bahrain-gateway.hdlcontrol.com";
+ /// <summary>
+ ///
+ /// </summary>
+ const string APP_KEY = "HDL-HOME-IND-APP";
+ /// <summary>
+ ///
+ /// </summary>
+ const string SECRET_KEY = "yPL345bn68gHnvilG4tYbq3cTYkiHu";
+
+#else
+ ///**********娴嬭瘯鐜**********
+ /// <summary>
+ /// 鍥哄畾鍩熷悕,娴嬭瘯澧�
+ /// 鍏叡鍩熷悕灏辫繎瑙f瀽
+ /// </summary>
+ public const string GlobalRequestHttpsHost = "https://china-gateway.hdlcontrol.com";
+ /// <summary>
+ ///
+ /// </summary>
+ const string APP_KEY = "HDL-APP-TENANT";
+ /// <summary>
+ ///
+ /// </summary>
+ const string SECRET_KEY = "CeL345bn28gHnvi9G4tYcq3cTYkiiC";
+#endif
/// <summary>
/// Get 璇锋眰鏈嶅姟鍣ㄦ柟娉�
@@ -151,7 +189,7 @@
/// <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)
{
- #region HttpWebRequest
+#region HttpWebRequest
try {
if (string.IsNullOrEmpty (urlHead)) {
@@ -224,7 +262,7 @@
return new ResponsePackNew () { Code = StateCode.NETWORK_ERROR };
}
- #endregion
+#endregion
}
@@ -295,7 +333,7 @@
/// <returns></returns>
public static byte [] RequestHttpsDownload (string apiPath, string bodyParameterJson = null, Dictionary<string, object> queryDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 20)
{
- #region RestRequest
+#region RestRequest
try {
if (string.IsNullOrEmpty (urlHead)) {
urlHead = GlobalRequestHttpsHost;
@@ -335,7 +373,7 @@
Utlis.WriteLine (ex.Message);
return null;
}
- #endregion
+#endregion
}
@@ -353,7 +391,7 @@
/// <returns></returns>
public static ResponsePackNew RequestHttpsUpload (Method method, string apiPath, object bodyParameterObject = null, Dictionary<string, object> queryDictionary = null, Dictionary<string, object> urlSegmentDictionary = null, string urlHead = "", string replaceToken = "", int mTimeout = 20)
{
- #region HttpWebRequest
+#region HttpWebRequest
try {
if (string.IsNullOrEmpty (urlHead)) {
@@ -420,7 +458,7 @@
return new ResponsePackNew () { Code = StateCode.NETWORK_ERROR };
}
- #endregion
+#endregion
}
@@ -436,7 +474,7 @@
/// <returns></returns>
public static byte [] HttpsDownload (string requestFullUrl, int mTimeout = 30)
{
- #region RestRequest
+#region RestRequest
try {
RestClient client = new RestClient (requestFullUrl);
RestRequest request = new RestRequest (Method.GET);
@@ -448,21 +486,23 @@
Utlis.WriteLine (ex.Message);
return null;
}
- #endregion
+#endregion
}
- #endregion
+#endregion
- #region **********绛惧悕鏍¢獙**********
- /// <summary>
- ///
- /// </summary>
- const string APP_KEY = "HDL-HOME-APP-TEST";
- /// <summary>
- ///
- /// </summary>
- const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
+#region **********绛惧悕鏍¢獙**********
+ ///// <summary>
+ /////
+ ///// </summary>
+ //const string APP_KEY = "HDL-HOME-APP-TEST";
+ ///// <summary>
+ /////
+ ///// </summary>
+ //const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss";
+
+
/// <summary>
/// 鑾峰彇褰撳墠鏃堕棿鎴冲��
@@ -554,7 +594,7 @@
}
}
- #endregion
+#endregion
}
/// <summary>
--
Gitblit v1.8.0