| | |
| | | { |
| | | ["Type"] = int.Parse(dictionary["Type"]), |
| | | ["Account"] = dictionary["Account"], |
| | | ["AccountName"] = dictionary["AccountName"], |
| | | ["UserId"] = dictionary["UserId"], |
| | | |
| | | }; |
| | |
| | | { "Relationship",logic.Relationship} , |
| | | { "LogicType",logic.LogicType} , |
| | | { "LogicCustomPushText",logic.LogicCustomPushText} , |
| | | { "LogicIsCustomPushText",logic.LogicIsCustomPushText} , |
| | | { "TimeAttribute", timeAttribute} , |
| | | { "Conditions", conditions }, |
| | | { "Actions", actions }, |
| | |
| | | date.Add("LogicName", logic.LogicName); |
| | | date.Add("Relationship", logic.Relationship); |
| | | date.Add("LogicCustomPushText", logic.LogicCustomPushText); |
| | | date.Add("LogicIsCustomPushText", logic.LogicIsCustomPushText); |
| | | mainGateWay?.Send("Logic/ReviseAttribute", jObject.ToString()); |
| | | //await System.Threading.Tasks.Task.Run(async () => |
| | | //{ |
| | |
| | | logic.LogicName = Logicifon["LogicName"].ToString(); |
| | | logic.LogicType = int.Parse(Logicifon["LogicType"].ToString()); |
| | | logic.Relationship = int.Parse(Logicifon["Relationship"].ToString()); |
| | | logic.LogicCustomPushText =Logicifon["LogicCustomPushText"].ToString(); |
| | | logic.LogicIsCustomPushText = int.Parse(Logicifon["LogicIsCustomPushText"].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()); |
| | |
| | | var room = new Common.Room(); |
| | | btnregionname.Text = room.GetRoomNameByDevice(device); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 找出楼层所有房间 |
| | | /// </summary> |
| | | /// <param name="floorId">楼层ID</param> |
| | | /// <returns></returns> |
| | | public static List<Common.Room> GetRoomList(string floorId) |
| | | { |
| | | return Common.Room.Lists.FindAll((obj) => obj.FloorId == floorId); |
| | |
| | | /////返回房间列表; |
| | | //return list1; |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取场景信息的方法 |
| | | /// </summary> |
| | |
| | | { |
| | | var list = new List<User>(); |
| | | var s = await ReadUserList(doorlockMac); |
| | | //var s = await Data("读取云端门锁数据", "/DoorLock/GetDoorLockPager", "POST", doorlockMac); |
| | | var jObject = JObject.Parse(s); |
| | | if (jObject == null || jObject["StateCode"].ToString() != "Success") |
| | | { |
| | |
| | | lockifon.doorlockmac = residential.doorlockmac; |
| | | return await WebClientAsync(2, lockifon.Url, lockifon); |
| | | } |
| | | |
| | | //打印NameValueCollection()显示索引, 键,值 |
| | | public static void PrintKeysAndValues2(NameValueCollection myCol) |
| | | { |
| | | for (int i = 0; i < myCol.Count; i++) |
| | | { |
| | | //打印显示索引, 键,值 |
| | | Console.WriteLine("[{0}]{1,-10} {2}", i, myCol.GetKey(i), myCol.Get(i)); |
| | | } |
| | | } |
| | | #region 定义解析门锁的对象 |
| | | public class Residential |
| | | { |
| | | /// <summary> |
| | |
| | | public bool IsFreezeUser; |
| | | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 门锁列表 |
| | | /// </summary> |
| | |
| | | /// </summary> |
| | | public static UserCenter.MemberInfoRes UserMemberInfoRes = null; |
| | | #endregion |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 自己用 |
| | | /// </summary> |
| | | public static void Zj(bool tag, Common.Logic logic) |
| | | { |
| | | new System.Threading.Thread(() => |
| | | { |
| | | if (logic.LogicId != 0) |
| | | { |
| | | if (tag) |
| | | { |
| | | Data("添加/更新", "/App/HomeLogicConfig", "POST"); |
| | | } |
| | | else |
| | | { |
| | | Data("删除", "/App/DelHomeLogicConfig", "POST"); |
| | | } |
| | | ///只改推送内容; |
| | | LogicControlSwitch(logic); |
| | | } |
| | | |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | #region 请求服务器方法--- |
| | | /// <summary> |
| | | /// 请求数据的封装方法 |
| | |
| | | /// <param name="method">请求方式为POST/GET</param> |
| | | /// <param name="obj">存储发送数据的对象</param> |
| | | /// <returns></returns> |
| | | public static async System.Threading.Tasks.Task<string>Data(string command, string url, string method, object obj = null) |
| | | public static async System.Threading.Tasks.Task<string> Data(string command, string url, string method, object obj = null) |
| | | { |
| | | var getUrl = CommonPage.RequestHttpsHost + url;//请求地址; |
| | | var getUrl = ""; |
| | | var jObject = new JObject(); |
| | | if (UserCenter.UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | { |
| | | getUrl = CommonPage.RequestHttpsHost + url;//请求地址; |
| | | jObject.Add("IsOtherAccountCtrl", false); |
| | | jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | } |
| | | else |
| | | { |
| | | getUrl = Config.Instance.AdminRequestBaseUrl + url;//请求地址; |
| | | jObject.Add("IsOtherAccountCtrl", true); |
| | | jObject.Add("LoginAccessToken", Config.Instance.AdminRequestToken); |
| | | } |
| | | switch (command) |
| | | { |
| | | case "添加/更新": |
| | | { |
| | | jObject.Add("RequestVersion", CommonPage.RequestVersion); |
| | | jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | //jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | jObject.Add("HomeId", Config.Instance.HomeId); |
| | | jObject.Add("LogicID", Common.Logic.CurrentLogic.LogicId); |
| | | jObject.Add("PushUserIds", new JArray { Config.Instance.Guid }); |
| | | jObject.Add("PushContent", Common.Logic.CurrentLogic.LogicCustomPushText); |
| | | |
| | | } |
| | | break; |
| | | case "删除": |
| | | { |
| | | jObject.Add("RequestVersion", CommonPage.RequestVersion); |
| | | jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | //jObject.Add("LoginAccessToken", Config.Instance.Token); |
| | | jObject.Add("HomeId", Config.Instance.HomeId); |
| | | 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); |
| | | } |