From 29209469ac17d877eb92d008456b58ad901bfb58 Mon Sep 17 00:00:00 2001
From: WJC <wjc@hdlchina.com.cn>
Date: 星期三, 30 十月 2019 14:37:42 +0800
Subject: [PATCH] 2019-10-30-1

---
 ZigbeeApp/Shared/Phone/Device/Logic/Send.cs |  151 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 142 insertions(+), 9 deletions(-)

diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
index 10c90c1..061d345 100644
--- a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
+++ b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs
@@ -4,12 +4,13 @@
 using ZigBee.Device;
 using ZigBee.Common;
 using Shared.Common;
+using System.Collections.Specialized;
 
 namespace Shared.Phone.Device.Logic
 {
     public class Send
     {
-
+        #region  ----鑾峰彇Logic
         /// <summary>
         /// 鑾峰彇LogicId鐨勬柟娉�
         /// </summary>
@@ -711,6 +712,7 @@
             return Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId);
 
         }
+# endregion
 
         #region  ----鑾峰彇闂ㄩ攣
         public static List<DoorLock> ReadDoorLockIfon(string doorlockMac)
@@ -722,7 +724,7 @@
             postValues.Add("RequestVersion", CommonPage.RequestVersion);
             postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token);
             System.Threading.Tasks.Task.Run(() =>
-            {
+            {
                 try
                 {
 
@@ -806,7 +808,7 @@
                     var RequestBaseUrl = jObject["ResponseData"]["RequestBaseUrl"].ToString();
                     var RequestToken = jObject["ResponseData"]["RequestToken"].ToString();
                     Residential lockifon = new Residential();
-                    lockifon.Url = RequestBaseUrl + "/App/GetDoorLockPager";
+                    lockifon.Url = RequestBaseUrl + "/DoorLock/GetDoorLockPager";
                     lockifon.Token = RequestToken;
                     lockifon.Id = Config.Instance.HomeId;
                     lockifon.IsOtherAccountCtrl = true;
@@ -862,13 +864,13 @@
                     }
 
                 }
-                catch
+                catch(Exception e)
                 {
-
+                    var s = e.Message;
                 }
 
             });
-            var datetime = DateTime.Now;
+           var datetime = DateTime.Now;
             while ((DateTime.Now - datetime).TotalMilliseconds < 3 * 1000)
             {
                 if (list.Count != 0)
@@ -914,9 +916,140 @@
             public string MembershipName = string.Empty;
         }
 
-        public static List<MembershipIfon> UserList = new List<MembershipIfon>();
-
-
+        public static List<MembershipIfon> UserList = new List<MembershipIfon>();
+
+
         #endregion
+        /*
+        public async System.Threading.Tasks.Task<List<>> a()
+        {
+            string url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager";
+            System.Collections.Specialized.NameValueCollection postValues = new System.Collections.Specialized.NameValueCollection();
+            postValues.Add("RequestVersion", CommonPage.RequestVersion);
+            postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token);
+            var str = await WebClientAsync(postValues, url);
+            var jObject = JObject.Parse(str);
+            if (jObject == null || jObject["StateCode"].ToString() != "Success")
+            {
+                return null;
+            }
+            var pageData = jObject["ResponseData"]["PageData"].ToString();
+            var datalist = JArray.Parse(pageData);
+            for (int i = 0; i < datalist.Count; i++)
+            {
+                var data = JObject.Parse(datalist[i].ToString());
+                if (Config.Instance.HomeId == data["Id"].ToString())
+                {
+                    Residential residential = new Residential();
+
+                    if (Convert.ToBoolean(data["IsOthreShare"].ToString()))
+                    {
+                        //鍒嗕韩鑰匢D
+                        residential.Id = data["Id"].ToString();
+                        //鏄惁鏄垎浜处鍙穂true(鏄垎浜�);false;(涓嶆槸鍒嗕韩)];
+                        residential.IsOthreShare = Convert.ToBoolean(data["IsOthreShare"].ToString());
+                        //鍒嗕韩鑰呬綇瀹匢D
+                        residential.MainUserDistributedMark = data["MainUserDistributedMark"].ToString();
+                        residential.IsOtherAccountCtrl = true;
+                        //residential.doorlockmac = doorlockMac;
+                        //list = ReadToken(residential);
+                    }
+                    else
+                    {
+                        residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/DoorLock/GetDoorLockPager";
+                        residential.Token = Config.Instance.Token;
+                        residential.Id = Config.Instance.HomeId;
+                        residential.IsOtherAccountCtrl = false;
+                        //residential.doorlockmac = doorlockMac;
+                        //list = ReadDoorLock(residential);
+
+                    }
+                }
+
+            }
+        }
+
+        public async System.Threading.Tasks.Task<string> aa(int value, string url, Residential residential = null)
+        {
+            NameValueCollection postValues = new NameValueCollection();
+            if (value == 1)
+            {
+
+            }
+            else if (value == 2)
+            {
+                postValues.Add("RequestVersion", CommonPage.RequestVersion);
+                postValues.Add("LoginAccessToken", Config.Instance.Token);
+                postValues.Add("MainAccountId", residential.MainUserDistributedMark);
+                postValues.Add("SharedHid", residential.Id);
+            }
+            else
+            {
+                postValues.Add("RequestVersion", CommonPage.RequestVersion);
+                postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token);
+
+            }
+            return await WebClientAsync(postValues, url);
+        }
+
+        public async System.Threading.Tasks.Task<string> aaa(NameValueCollection postValues, string url)
+        {
+            var str = await aa(0, "https://global.hdlcontrol.com/HangZhouHdlCloudApi/App/GetHomePager");
+            var jObject = JObject.Parse(str);
+            if (jObject == null || jObject["StateCode"].ToString() != "Success")
+            {
+                return null;
+            }
+            var pageData = jObject["ResponseData"]["PageData"].ToString();
+            var datalist = JArray.Parse(pageData);
+            for (int i = 0; i < datalist.Count; i++)
+            {
+                var data = JObject.Parse(datalist[i].ToString());
+                if (Config.Instance.HomeId == data["Id"].ToString())
+                {
+                    Residential residential = new Residential();
+                    if (Convert.ToBoolean(data["IsOthreShare"].ToString()))
+                    {
+                        //鍒嗕韩鑰匢D
+                        residential.Id = data["Id"].ToString();
+                        //鏄惁鏄垎浜处鍙穂true(鏄垎浜�);false;(涓嶆槸鍒嗕韩)];
+                        residential.IsOthreShare = Convert.ToBoolean(data["IsOthreShare"].ToString());
+                        //鍒嗕韩鑰呬綇瀹匢D
+                        residential.MainUserDistributedMark = data["MainUserDistributedMark"].ToString();
+                        residential.IsOtherAccountCtrl = true;
+                        //residential.doorlockmac = doorlockMac;
+                        //list = ReadToken(residential);
+                      
+                        var str = await WebClientAsync(residential, postValues, url);
+                    }
+                    else
+                    {
+                        residential.Url = "https://global.hdlcontrol.com/HangZhouHdlCloudApi/DoorLock/GetDoorLockPager";
+                        residential.Token = Config.Instance.Token;
+                        residential.Id = Config.Instance.HomeId;
+                        residential.IsOtherAccountCtrl = false;
+                        //residential.doorlockmac = doorlockMac;
+                        var str = await WebClientAsync(postValues, url);
+
+                    }
+                }
+
+            }
+        }
+
+        /// <summary>
+        /// 璇锋眰鏈嶅姟鍣ㄧ殑鏂规硶
+        /// </summary>
+        /// <param name="postValues">post鍙傛暟</param>
+        /// <param name="url"></param>
+        /// <returns></returns>
+        public async System.Threading.Tasks.Task<string> WebClientAsync(NameValueCollection postValues, string url)
+        {
+
+            System.Net.WebClient webClient = new System.Net.WebClient();
+            byte[] responseArray = webClient.UploadValues(url, postValues);
+            return System.Text.Encoding.UTF8.GetString(responseArray);
+        }
+        */
     }
 }

--
Gitblit v1.8.0