| | |
| | | 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> |
| | |
| | | return Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId); |
| | | |
| | | } |
| | | # endregion |
| | | |
| | | #region ----获取门锁 |
| | | public static List<DoorLock> ReadDoorLockIfon(string doorlockMac) |
| | |
| | | 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; |
| | |
| | | } |
| | | |
| | | } |
| | | catch |
| | | catch(Exception e) |
| | | { |
| | | |
| | | var s = e.Message; |
| | | } |
| | | |
| | | }); |
| | |
| | |
|
| | |
|
| | | #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())) |
| | | { |
| | | //分享者ID |
| | | residential.Id = data["Id"].ToString(); |
| | | //是否是分享账号[true(是分享);false;(不是分享)]; |
| | | residential.IsOthreShare = Convert.ToBoolean(data["IsOthreShare"].ToString()); |
| | | //分享者住宅ID |
| | | 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())) |
| | | { |
| | | //分享者ID |
| | | residential.Id = data["Id"].ToString(); |
| | | //是否是分享账号[true(是分享);false;(不是分享)]; |
| | | residential.IsOthreShare = Convert.ToBoolean(data["IsOthreShare"].ToString()); |
| | | //分享者住宅ID |
| | | 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); |
| | | } |
| | | */ |
| | | } |
| | | } |