From f60b17fa18701c2cee017a5117e96510f54b44cf Mon Sep 17 00:00:00 2001 From: wxr <wxr@hdlchina.com.cn> Date: 星期一, 02 十二月 2024 16:05:44 +0800 Subject: [PATCH] 更新功能 --- HDL_ON/DAL/Server/HttpUtil.cs | 74 +++++++++++++++++++++++++++++++------ 1 files changed, 62 insertions(+), 12 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 9418b32..168036b 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -12,21 +12,74 @@ { public class HttpUtil { + static HttpUtil _HttpUtil; + public static HttpUtil Ins + { + get + { + if (_HttpUtil == null) + { + _HttpUtil = new HttpUtil(); + } + return _HttpUtil; + } + } #region **********鍏ㄥ眬甯搁噺********** + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + //public const string APP_KEY = "QWERREWQ"; + //public const string SECRET_KEY = "CPBUCTRLCPBUABCD"; + + + string _GlobalRequestHttpsHost; /// <summary> /// 鍥哄畾鍩熷悕,姝e紡鐜 /// 鍏叡鍩熷悕灏辫繎瑙f瀽 /// </summary> - public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; - public const string APP_KEY = "QWERREWQ"; - public const string SECRET_KEY = "CPBUCTRLCPBUABCD"; - - - //public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; - //public const string APP_KEY = "HDL-HOME-APP-TEST"; - //public const string SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; + public string GlobalRequestHttpsHost + { + get + { + _GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + if (OnAppConfig.Instance.HostType == RequestHostType.ONLINE) + _GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; + else if (OnAppConfig.Instance.HostType == RequestHostType.TEST) + _GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; + else if (OnAppConfig.Instance.HostType == RequestHostType.DEV) + _GlobalRequestHttpsHost = "http://59.41.255.150:7777"; + return _GlobalRequestHttpsHost; + } + } + string app_key; + public string APP_KEY + { + get + { + app_key = "QWERREWQ"; + if (OnAppConfig.Instance.HostType == RequestHostType.ONLINE) + app_key = "QWERREWQ"; + else if (OnAppConfig.Instance.HostType == RequestHostType.TEST) + app_key = "HDL-HOME-APP-TEST"; + else if (OnAppConfig.Instance.HostType == RequestHostType.DEV) + app_key = "CPEVRLRT"; + return app_key; + } + } + string _SECRET_KEY; + public string SECRET_KEY + { + get + { + _SECRET_KEY = "CPBUCTRLCPBUABCD"; + if (OnAppConfig.Instance.HostType == RequestHostType.ONLINE) + _SECRET_KEY = "CPBUCTRLCPBUABCD"; + else if (OnAppConfig.Instance.HostType == RequestHostType.TEST) + _SECRET_KEY = "WeJ8TY88vbakCcnvH8G1tDUqzLWY8yss"; + else if (OnAppConfig.Instance.HostType == RequestHostType.DEV) + _SECRET_KEY = "CPEVRLSJCPEVRLSZ"; + return _SECRET_KEY; + } + } /// <summary> @@ -163,13 +216,11 @@ #region HttpWebRequest try { - if (string.IsNullOrEmpty(urlHead)) { urlHead = OnAppConfig.Instance.RequestHttpsHost; } string requestFullUrl = urlHead + apiPath; - RestClient client = new RestClient(requestFullUrl); @@ -189,7 +240,6 @@ { request.AddHeader("Authorization", replaceToken); } - if (bodyParameterJson != null) { -- Gitblit v1.8.0