old mode 100755
new mode 100644
| | |
| | | using System.Collections.Generic; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using Java.Util; |
| | | using Newtonsoft.Json; |
| | | using Newtonsoft.Json.Linq; |
| | | using Shared; |
| | |
| | | |
| | | #region 门锁本地变量 |
| | | /// <summary> |
| | | /// 门锁本地用户列表 |
| | | /// 本地门锁用户和账户列表 |
| | | /// key:门锁用户ID |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Dictionary<int, LocaDoorLockObj> localDoorLockUserList = new Dictionary<int, LocaDoorLockObj>(); |
| | | public string currentUserDisplayMethod = string.Empty; |
| | | /// <summary> |
| | | /// 本地门账户列表 |
| | | /// key:账户ID(主账户是GUID,子账户是分享过来的账户ID) |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public Dictionary<string, LocaDoorLockObj> localDoorLockAccountList = new Dictionary<string, LocaDoorLockObj>(); |
| | | |
| | | public string currentUserDisplayMethod = string.Empty;//当前用户显示方式 |
| | | //本地所有账户列表 |
| | | public List<Shared.Phone.UserCenter.MemberInfoRes> localAllAccountList = new List<Shared.Phone.UserCenter.MemberInfoRes> { }; |
| | | public static int RemoteUnlockCount = 3;//远程开锁次数限制 |
| | | public static int RemoteUnlockCount = 5;//远程开锁次数限制 |
| | | public static string RemoteUnlockPassword = string.Empty;//远程开锁密码 |
| | | public static DateTime maxValue = DateTime.MaxValue; |
| | | public static DateTime minValue = DateTime.MinValue; |
| | | |
| | | public string LocalTempPassword = string.Empty;//本地生成的临时密码 |
| | | |
| | | |
| | | public Dictionary<string, bool> IsFreezeAccount = new Dictionary<string, bool> { };//是否冻结子账户 |
| | | public Dictionary<string, bool> HasRemoteUnlockAccess = new Dictionary<string, bool> { };//是否给子账户拥有远程开锁的条件 |
| | | public Dictionary<string, bool> IsFailedToGetDoorLockInfo = new Dictionary<string, bool> { };//是否获取门锁数据失败 |
| | | #region 临时密码信息 |
| | | /// <summary> |
| | | /// 用户管理发送数据回复 |
| | |
| | | /// 门锁本地用户Id -->键名 : DoorLockLocalUserId |
| | | /// </summary> |
| | | public string DoorLockLocalUserId = ""; |
| | | |
| | | /// <summary> |
| | | /// IsOtherAccountCtrl 是否为子帐号控制过来 -->键名 : IsOtherAccountCtrl |
| | | /// </summary> |
| | | public bool IsOtherAccountCtrl = false; |
| | | } |
| | | #endregion |
| | | |
| | |
| | | /// PrimaryId 门锁云端主 键(非更新字段,以下均为更新字段) -->键名 : PrimaryId默认值: null |
| | | /// </summary> |
| | | public string PrimaryId = ""; |
| | | /// <summary> |
| | | /// 云端帐号Id -->键名 : CloudAccountId |
| | | /// </summary> |
| | | public string CloudAccountId = ""; |
| | | /// <summary> |
| | | /// OpenLockMode 开锁方式(密码、指纹、IC卡) -->键名 : OpenLockMode (可选) |
| | | /// </summary> |
| | |
| | | /// 0:00:00] ValidEndTime 有效结束时间 -->键名 : ValidEndTime |
| | | /// </summary> |
| | | public DateTime ValidEndTime; |
| | | /// <summary> |
| | | /// IsOtherAccountCtrl 是否为子帐号控制过来 -->键名 : IsOtherAccountCtrl |
| | | /// </summary> |
| | | public bool IsOtherAccountCtrl = false; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// LocalDoorLockId 搜索本地门锁Id -->键名 : LocalDoorLockId 默认值: null |
| | | /// </summary> |
| | | public string LocalDoorLockId = ""; |
| | | /// <summary> |
| | | /// IsOtherAccountCtrl 是否为子帐号控制过来 -->键名 : IsOtherAccountCtrl |
| | | /// </summary> |
| | | public bool IsOtherAccountCtrl = false; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 0:00:00] ValidEndTime 有效结束时间 -->键名 : ValidEndTime |
| | | /// </summary> |
| | | public DateTime ValidEndTime; |
| | | /// <summary> |
| | | /// IsOtherAccountCtrl 是否为子帐号控制过来 -->键名 : IsOtherAccountCtrl |
| | | /// </summary> |
| | | public bool IsOtherAccountCtrl = false; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// 0:00:00] ValidEndTime 有效结束时间 -->键名 : ValidEndTime |
| | | /// </summary> |
| | | public DateTime? ValidEndTime; |
| | | /// <summary> |
| | | /// IsOtherAccountCtrl 是否为子帐号控制过来 -->键名 : IsOtherAccountCtrl |
| | | /// </summary> |
| | | public bool IsOtherAccountCtrl = false; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取门锁临时密码结果 |
| | | /// </summary> |
| | | /// </summary> |
| | | [Serializable] |
| | | public class GetDoorLockTempPasswordDataRes |
| | | { |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取门锁给云服务器 |
| | | /// 获取门锁云服务器 |
| | | /// </summary> |
| | | public static async System.Threading.Tasks.Task<GetDoorLockDataRes> GetDoorLockInfoFromServer(string RequestName, GetDoorLockData getDoorLockData) |
| | | { |
| | |
| | | { |
| | | //序列化对象 |
| | | var requestJson = JsonConvert.SerializeObject(obj); |
| | | var byteData = System.Text.Encoding.UTF8.GetBytes(requestJson); |
| | | byte[] result1 = null; |
| | | //访问接口 |
| | | var result = await CommonPage.Instance.RequestHttpsZigbeeAsync(RequestName, System.Text.Encoding.UTF8.GetBytes(requestJson)); |
| | | |
| | | return result; |
| | | if (UserCenterResourse.UserInfo.AuthorityNo == 1) |
| | | { |
| | | result1 = await CommonPage.Instance.RequestHttpsZigbeeBytesResultAsync(RequestName, byteData); |
| | | } |
| | | else |
| | | { |
| | | result1 = await CommonPage.Instance.RequestZigbeeHttpsByAdmin(RequestName, byteData); |
| | | } |
| | | if (result1 != null) |
| | | { |
| | | var result2 = Encoding.UTF8.GetString(result1); |
| | | if (result2 != null) |
| | | { |
| | | var result = Newtonsoft.Json.JsonConvert.DeserializeObject<Shared.Common.ResponseEntity.ResponsePack>(result2); |
| | | return result; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | { |
| | | DoorLockAccountList.Clear(); |
| | | return await System.Threading.Tasks.Task.Run((Func<System.Threading.Tasks.Task<List<Shared.Phone.UserCenter.MemberInfoRes>>>)(async () => |
| | | { |
| | | var pra = new Shared.Phone.UserCenter.MemberListInfoPra(); |
| | | string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); |
| | | var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Shared.Phone.UserCenter.MemberInfoRes>>(result); |
| | | return listInfo; |
| | | })); |
| | | { |
| | | var pra = new Shared.Phone.UserCenter.MemberListInfoPra(); |
| | | string result = await UserCenterLogic.GetResponseDataByRequestHttps("ZigbeeUsers/GetSubAccountByDistributedMark", false, pra); |
| | | var listInfo = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Shared.Phone.UserCenter.MemberInfoRes>>(result); |
| | | return listInfo; |
| | | })); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | result = new DefaultControlResponseAllData { errorMessageBase = "网关返回的数据为空" }; |
| | | } |
| | | else |
| | | {
|
| | | { |
| | | if (gatewayTemp.clientDataPassthroughResponseData?.PassData != null) |
| | | { |
| | | var data = gatewayTemp.clientDataPassthroughResponseData.PassData; |
| | |
| | | tempD.command = data[12].ToString() + data[13].ToString() + data[10].ToString() + data[11].ToString(); |
| | | tempD.status = Convert.ToInt32(data[14].ToString() + data[15].ToString(), 16); |
| | | result = new DefaultControlResponseAllData { defaultControlResponseData = tempD }; |
| | | DebugPrintLog($"UI收到通知后的主题_command:0402_{ topic}"); |
| | | DebugPrintLog($"UI收到通知后的主题_command:0450_{ topic}"); |
| | | } |
| | | } |
| | | } |
| | |
| | | break; |
| | | } |
| | | } |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > WaitReceiveDataTime) |
| | | if ((DateTime.Now - dateTime).TotalMilliseconds > 9000) |
| | | { |
| | | result = new DefaultControlResponseAllData { errorMessageBase = " 回复超时,请重新操作" }; |
| | | } |
| | |
| | | public async System.Threading.Tasks.Task<DoorlockUserInfo> GetDoorlockUserInfoAsync() |
| | | { |
| | | DoorlockUserInfo result = null; |
| | | int totalNum = 0; |
| | | int currentNum = -1; |
| | | DoorLockUserDetailData doorLockUserDetailData = new DoorLockUserDetailData { }; |
| | | if (Gateway == null) |
| | | { |
| | |
| | | var data = new JObject { { "PassData", passData } }; |
| | | jObject.Add("Data", data); |
| | | Gateway.Send(("ClientDataPassthrough"), jObject.ToString()); |
| | | |
| | | } |
| | | catch { } |
| | | |
| | | //接收一个包最多等5秒,没有收到就退出 |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 5000) |
| | | //接收一个包最多等3秒,没有收到就退出 |
| | | while ((DateTime.Now - dateTime).TotalMilliseconds < 3000) |
| | | { |
| | | await System.Threading.Tasks.Task.Delay(100); |
| | | } |
| | | |
| | | Gateway.Actions -= action; |
| | | DebugPrintLog("ClientDataPassthrough_Actions 退出" + System.DateTime.Now.ToString()); |
| | | |
| | |
| | | |
| | | #endregion |
| | | } |
| | | } |
| | | } |