From e87985ec1dcb69beedaf9f95e8e7aba14b7c08d6 Mon Sep 17 00:00:00 2001 From: JLChen <551775569@qq.com> Date: 星期三, 09 十二月 2020 18:50:14 +0800 Subject: [PATCH] 2020-12-09 1.信息中心,增加下划线和点击Alter提醒详情。 --- HDL_ON/DAL/Server/HttpUtil.cs | 87 ++++++++++++++++++++++++++++++------------- 1 files changed, 61 insertions(+), 26 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpUtil.cs b/HDL_ON/DAL/Server/HttpUtil.cs index 0fa2299..1cca265 100644 --- a/HDL_ON/DAL/Server/HttpUtil.cs +++ b/HDL_ON/DAL/Server/HttpUtil.cs @@ -6,7 +6,6 @@ using System.Text; using HDL_ON.Entity; using RestSharp; -using Shared; namespace HDL_ON.DAL.Server { @@ -38,9 +37,9 @@ #endregion /// <summary> - /// 鍥哄畾鍩熷悕 + /// 鍥哄畾鍩熷悕,姝e紡鐜 /// </summary> - //public const string GlobalRequestHttpsHost = "https://center.hdlcontrol.com"; + //public const string GlobalRequestHttpsHost = "https://nearest.hdlcontrol.com"; public const string GlobalRequestHttpsHost = "https://test-gz.hdlcontrol.com"; /// <summary> @@ -152,16 +151,16 @@ try { - //if (string.IsNullOrEmpty(urlHead)) - //{ - // urlHead = UserInfo.Current.RequestHttpsHost; - //} - //string requestFullUrl = urlHead + apiPath; + if (string.IsNullOrEmpty(urlHead)) + { + urlHead = UserInfo.Current.RequestHttpsHost; + } + string requestFullUrl = urlHead + apiPath; - //**************娴嬭瘯************** - string requestFullUrl = GlobalRequestHttpsHost + apiPath; - //**************娴嬭瘯************** + ////**************娴嬭瘯************** + //string requestFullUrl = GlobalRequestHttpsHost + apiPath; + ////**************娴嬭瘯************** RestClient client = new RestClient(requestFullUrl); @@ -208,6 +207,7 @@ { try { + ResponsePackNew revertObj = new ResponsePackNew() { }; revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content); //*****涓�浜涘垽绌哄鐞�***************** @@ -264,14 +264,15 @@ #region RestRequest try { - //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = UserInfo.Current.RequestHttpsHost; - //} - //string requestFullUrl = urlHead + apiPath; + if (string.IsNullOrEmpty(urlHead)) + { + urlHead = UserInfo.Current.RequestHttpsHost; + } + string requestFullUrl = urlHead + apiPath; - //**************娴嬭瘯************** - string requestFullUrl = GlobalRequestHttpsHost + apiPath; - //**************娴嬭瘯************** + ////**************娴嬭瘯************** + //string requestFullUrl = GlobalRequestHttpsHost + apiPath; + ////**************娴嬭瘯************** RestClient client = new RestClient(requestFullUrl); //client.Timeout = mTimeout * 1000; @@ -334,14 +335,15 @@ try { - //if (string.IsNullOrEmpty (urlHead)) { - // urlHead = UserInfo.Current.RequestHttpsHost; - //} - //string requestFullUrl = urlHead + apiPath; + if (string.IsNullOrEmpty(urlHead)) + { + urlHead = UserInfo.Current.RequestHttpsHost; + } + string requestFullUrl = urlHead + apiPath; - //**************娴嬭瘯************** - string requestFullUrl = GlobalRequestHttpsHost + apiPath; - //**************娴嬭瘯************** + ////**************娴嬭瘯************** + //string requestFullUrl = GlobalRequestHttpsHost + apiPath; + ////**************娴嬭瘯************** RestClient client = new RestClient(requestFullUrl); //client.Timeout = mTimeout * 1000; @@ -422,6 +424,38 @@ } /// <summary> + /// 涓嬭浇鏂囦欢 璇锋眰鏈嶅姟鍣ㄦ柟娉� + /// </summary> + /// <param name="apiPath"></param> + /// <param name="bodyParameterJson"></param> + /// <param name="queryDictionary"></param> + /// <param name="urlHead"></param> + /// <param name="replaceToken"></param> + /// <param name="mTimeout"></param> + /// <returns></returns> + public static byte[] HttpsDownload(string requestFullUrl, int mTimeout = 30) + { + #region RestRequest + try + { + RestClient client = new RestClient(requestFullUrl); + RestRequest request = new RestRequest(Method.GET); + request.Timeout = mTimeout * 1000; + + IRestResponse response = client.Execute(request); + return response.RawBytes; + } + catch (Exception ex) + { + HDL_ON.Utlis.WriteLine(ex.Message); + return null; + } + #endregion + + } + + + /// <summary> /// /// </summary> const string APP_KEY = "HDL-HOME-APP-TEST"; @@ -437,7 +471,8 @@ static string GetTimestamp() { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); // 褰撳湴鏃跺尯 - return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 鐩稿樊绉掓暟 + return ((long)(DateTime.Now - startTime).TotalMilliseconds).ToString(); // 鐩稿樊绉掓暟 + //return ((long)(DateTime.Now - startTime).TotalSeconds).ToString(); // 鐩稿樊绉掓暟 } /// <summary> -- Gitblit v1.8.0