From 28d269d8aa90eca5470fff825a9b9545135a3ec0 Mon Sep 17 00:00:00 2001
From: 黄学彪 <hxb@hdlchina.com.cn>
Date: 星期三, 16 十二月 2020 17:37:26 +0800
Subject: [PATCH] 上传一个初始版本

---
 HDL_ON/DAL/Server/HttpServerRequest.cs |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 0052ff6..66f61fc 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -131,13 +131,31 @@
         /// 缁戝畾璋冭瘯浜哄憳鎻愪氦鐨勪綇瀹�,涓�涓綇瀹呭彧鑳界粦瀹氫竴娆�
         /// </summary>
         /// <returns></returns>
-        public ResponsePackNew BindingResidence(string key)
+        public ResponsePackNew BindingResidence(string strUrl)
         {
-            Dictionary<string, object> d = new Dictionary<string, object>();
-            //d.Add("homeId", homeId);
-            d.Add("secretKey", key);
-            var requestJson = HttpUtil.GetSignRequestJson(d);
-            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_BindlingResidence, requestJson, HttpUtil.GlobalRequestHttpsHost);
+            try
+            {
+                var client = new RestSharp.RestClient(strUrl);
+
+                var request = new RestSharp.RestRequest(RestSharp.Method.GET);
+                request.Timeout = 5 * 1000;
+                request.AddHeader("content-type", "application/json");
+                request.AddHeader("Authorization", UserInfo.Current.LoginTokenString);
+
+                var response = client.Execute(request);
+                if (response.StatusCode == HttpStatusCode.OK)
+                {
+                    return Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePackNew>(response.Content);
+                }
+                else
+                {
+                    return null;
+                }
+            }
+            catch
+            {
+                return null;
+            }
         }
 
         #region 娉ㄥ唽銆佺櫥褰曢儴鍒�
@@ -600,8 +618,12 @@
                                 DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];
                                 if(mHomeGatewayRes[0].gatewayStatus == "ON_LINE")
                                 {
-                                    DriverLayer.Control.Ins.IsRemote = true;
+                                    //DriverLayer.Control.Ins.IsRemote = true;
                                     DriverLayer.Control.Ins.GatewayOnline = true;
+                                }
+                                else
+                                {
+                                    DriverLayer.Control.Ins.GatewayOnline = false;
                                 }
                                 DB_ResidenceData.Instance.SaveResidenceData();
                                 return;
@@ -1928,7 +1950,7 @@
             d.Add("userSceneIds",new List<string>() { seceneId });
 
             var requestJson = HttpUtil.GetSignRequestJson(d);
-            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson);
         }
         /// <summary>
         /// 娣诲姞鍦烘櫙

--
Gitblit v1.8.0