| | |
| | | { |
| | | public class Send |
| | | { |
| | | #region ----获取Logic |
| | | #region ----Logic所有发送命令 |
| | | /// <summary> |
| | | /// 获取LogicId的方法 |
| | | /// </summary> |
| | |
| | | { |
| | | ["Type"] = int.Parse(dictionary["Type"]), |
| | | ["Account"] = dictionary["Account"], |
| | | ["AccountName"] = dictionary["AccountName"], |
| | | ["UserId"] = dictionary["UserId"], |
| | | |
| | | }; |
| | |
| | | return listLogic; |
| | | }); |
| | | } |
| | | // <summary> |
| | | /// 通过设备找到区域(房间)名称 |
| | | /// </summary> |
| | | /// <param name="btnregionname">Btnregionname.</param> |
| | | /// <param name="device">Device.</param> |
| | | public static void RoomNmae(Button btnregionname, CommonDevice device) |
| | | { |
| | | var room = new Common.Room(); |
| | | btnregionname.Text = UserCenter.HdlRoomLogic.Current.GetRoomNameByDevice(device); |
| | | } |
| | | /// <summary> |
| | | /// 找出楼层所有房间 |
| | | /// </summary> |
| | | /// <param name="floorId">楼层ID</param> |
| | | /// <returns></returns> |
| | | public static List<Common.Room> GetRoomList(string floorId) |
| | | { |
| | | return UserCenter.HdlRoomLogic.Current.GetAllListRooms().FindAll((obj) => obj.FloorId == floorId); |
| | | //var list1 = new List<Common.Room>(); |
| | | /////找到某楼层房间列表; |
| | | //var list = Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId); |
| | | //for (int i = 0; i < list.Count; i++) |
| | | //{ |
| | | // if (str == "device") |
| | | // { |
| | | // if (list[i].DeviceUIList.Count != 0) |
| | | // { ///过滤掉没有设备的房间 |
| | | // list1.Add(list[i]); |
| | | // } |
| | | // } |
| | | // else |
| | | // { |
| | | // if (list[i].SceneUIList.Count != 0) |
| | | // { ///过滤掉没有场景的房间 |
| | | // list1.Add(list[i]); |
| | | // } |
| | | // } |
| | | //} |
| | | /////返回房间列表; |
| | | //return list1; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取场景信息的方法 |
| | | /// </summary> |
| | |
| | | if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo != 3) |
| | | { |
| | | var pra = new UserCenter.MemberListInfoPra(); |
| | | string result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); |
| | | string result = ""; |
| | | if (AllUserIfon.Count != 0) |
| | | { |
| | | //服务返回来没有门锁成员信息,没有必要再去请求成员列表, |
| | | //原因:节约时间,体验效果好; |
| | | result = await UserCenter.UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); |
| | | } |
| | | var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<UserCenter.MemberInfoRes>>(result); |
| | | for (int i = 0; i < listInfo.Count; i++) |
| | | { |
| | |
| | | lockifon.doorlockmac = residential.doorlockmac; |
| | | return await WebClientAsync(2, lockifon.Url, lockifon); |
| | | } |
| | | #region 定义解析门锁的对象 |
| | | |
| | | public class Residential |
| | | { |
| | | /// <summary> |
| | |
| | | public bool IsFreezeUser; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 门锁列表 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public static UserCenter.MemberInfoRes UserMemberInfoRes = null; |
| | | #endregion |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 自己用 |
| | | /// 自己用的发送的方法 |
| | | /// </summary> |
| | | /// <param name="tag">标记是那条命令</param> |
| | | /// <param name="logic">逻辑对象</param> |
| | | public static void Zj(bool tag, Common.Logic logic) |
| | | { |
| | | new System.Threading.Thread(() => |
| | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | #region 请求服务器方法--- |
| | | /// <summary> |
| | | /// 请求数据的封装方法 |
| | |
| | | jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId); |
| | | } |
| | | break; |
| | | case "读取云端门锁数据": |
| | | { |
| | | jObject.Add("RequestVersion", CommonPage.RequestVersion); |
| | | jObject.Add("HomeId", Config.Instance.HomeId); |
| | | jObject.Add("DoorLockId", obj.ToString());//门锁Mac+端口 |
| | | jObject.Add("PageSetting.PageSize", Int32.MaxValue.ToString()); |
| | | } |
| | | break; |
| | | |
| | | } |
| | | return await HttpWebRequest(getUrl, jObject.ToString(), method); |
| | | } |
| | |
| | | postValues.Add("LoginAccessToken", Config.Instance.Token); |
| | | postValues.Add("MainAccountId", residential.MainUserDistributedMark); |
| | | postValues.Add("SharedHid", residential.Id); |
| | | |
| | | } |
| | | break; |
| | | case 2: |
| | |
| | | return System.Text.Encoding.UTF8.GetString(varByte);
|
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 判断字典是否存在的方法 |
| | | /// </summary> |
| | | /// <param name="deviceConditionsInfo"></param> |
| | | /// <param name="Key"></param> |
| | | /// <param name="Value"></param> |
| | | public static void dictionary(Dictionary<string, string> deviceConditionsInfo, string Key, string Value) |
| | | { |
| | | if (deviceConditionsInfo.ContainsKey(Key)) |
| | | { |
| | | deviceConditionsInfo.Remove(Key); |
| | | } |
| | | deviceConditionsInfo.Add(Key, Value); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |