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 | 154 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 144 insertions(+), 10 deletions(-) diff --git a/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs b/ZigbeeApp/Shared/Phone/Device/Logic/Send.cs old mode 100755 new mode 100644 index 4c72631..061d345 --- 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> @@ -608,9 +609,10 @@ logic.IsEnable = int.Parse(Logicifon["IsEnable"].ToString()); logic.LogicName = Logicifon["LogicName"].ToString(); logic.LogicType = int.Parse(Logicifon["LogicType"].ToString()); - logic.Relationship = int.Parse(Logicifon["Relationship"].ToString()); + logic.Relationship = int.Parse(Logicifon["Relationship"].ToString()); logic.TimeAttribute = Newtonsoft.Json.JsonConvert.DeserializeObject<Common.TimeAttributeObj>(Logicifon["TimeAttribute"].ToString()); logic.Conditions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(Logicifon["Conditions"].ToString()); + logic.Accounts = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, string>>>(Logicifon["Accounts"].ToString()); List<Dictionary<string, object>> listactions = new List<Dictionary<string, object>>(); listactions = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(Logicifon["Actions"].ToString()); @@ -710,6 +712,7 @@ return Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId); } +# endregion #region ----鑾峰彇闂ㄩ攣 public static List<DoorLock> ReadDoorLockIfon(string doorlockMac) @@ -721,7 +724,7 @@ postValues.Add("RequestVersion", CommonPage.RequestVersion); postValues.Add("ReqDto.LoginAccessToken", Config.Instance.Token); System.Threading.Tasks.Task.Run(() => - { + { try { @@ -805,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; @@ -861,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) @@ -913,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