| | |
| | | /// <param name="deviceId">设备ID</param> |
| | | /// <param name="deviceKey">功能查询类型:pm25</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey) |
| | | public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("type", qType); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", new List<string>() { deviceId }); |
| | | d.Add("key", new List<string>() { deviceKey }); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("key", deviceKey); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); |
| | |
| | | /// <param name="pageSize">页面大小</param> |
| | | /// <param name="pageNo">页号</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo) |
| | | public ResponsePackNew GetArmSensorHistory(string deviceId, string pageSize, string pageNo) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson); |
| | | } |
| | | /// <summary> |
| | | /// 读取最近一个月的数据 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetLastMonthHistory(string deviceId, string key) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceId", deviceId); |
| | | d.Add("key", key); |
| | | |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_SensorLastMonthHistoricalData, requestJson); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | |
| | | UserInfo.Current.RefreshToken = revertData.refreshToken; |
| | | UserInfo.Current.LastTime = DateTime.Now; |
| | | UserInfo.Current.SaveUserInfo(); |
| | | |
| | | #if __IOS__ |
| | | var sdm = new SiriKit.SceneDateManager(); |
| | | sdm.AccessToken = UserInfo.Current.LoginTokenString; |
| | | sdm.RefreshToken = UserInfo.Current.RefreshToken; |
| | | #endif |
| | | } |
| | | return revertObj.Code; |
| | | } |
| | |
| | | account = account, |
| | | loginPwd = password |
| | | }); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); |
| | | var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | |
| | | #if __IOS__ |
| | | var sdm = new SiriKit.SceneDateManager(); |
| | | sdm.IsLgoin = true; |
| | | #endif |
| | | } |
| | | } |
| | | return pack; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | verifyCode = vCode, |
| | | grantType = "verify" |
| | | }); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); |
| | | var pack = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Login, requestJson); |
| | | if (pack != null) |
| | | { |
| | | if (pack.Code == StateCode.SUCCESS) |
| | | { |
| | | |
| | | #if __IOS__ |
| | | var sdm = new SiriKit.SceneDateManager(); |
| | | sdm.IsLgoin = true; |
| | | #endif |
| | | } |
| | | } |
| | | return pack; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | /// <returns></returns> |
| | | public ResponsePackNew ValidataCodeAndRegister(string account, string password, string code, bool isPhone = false) |
| | | { |
| | | var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code};//, memberName = account |
| | | var requestObj = new RegisterObj() { loginPwd = password, verifyCode = code };//, memberName = account |
| | | if (isPhone) |
| | | { |
| | | requestObj.memberPhone = account; |
| | |
| | | UserInfo.Current.userEmailInfo = info.memberEmail; |
| | | UserInfo.Current.userMobileInfo = info.memberPhone; |
| | | UserInfo.Current.userName = info.memberName; |
| | | |
| | | |
| | | if (!string.IsNullOrEmpty(info.memberPhonePrefix)) |
| | | { |
| | | UserInfo.Current.areaCode = info.memberPhonePrefix; |
| | |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UnbindWithAccount, requestJson).Code; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 根据账号,获取账号信息 |
| | | /// </summary> |
| | | /// <param name="i_account">指定账号</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetMemberInfoByAccount(string i_account) |
| | | { |
| | | var pra = new { account = i_account }; |
| | | var requestJson = HttpUtil.GetSignRequestJson(pra); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfoByAccount, requestJson); |
| | | } |
| | | |
| | | #endregion |
| | | |
| | | #region 住宅部分 |
| | | /// <summary> |
| | | /// 获取住宅列表 |
| | | /// </summary> |
| | | public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL) |
| | | public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL, string homeId = "") |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetHomeListObj() { homeType = homeType.ToString() }); |
| | | var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson); |
| | |
| | | { |
| | | foreach (var home in homeList) |
| | | { |
| | | //var home = new RegionInfoRes() |
| | | //{ |
| | | // RegionID = mHome.Id, |
| | | // Name = mHome.homeName, |
| | | // IsOthreShare = mHome.IsOtherShare, |
| | | // accountType = mHome.accountType, |
| | | // isRemoteControl = mHome.isRemoteControl, |
| | | // isBindGateway = mHome.isBindGateway, |
| | | // longitude = mHome.longitude, |
| | | // latitude = mHome.latitude, |
| | | // deliverstatus = mHome.deliverstatus, |
| | | // homeType = mHome.homeType, |
| | | // regionUrl = mHome.regionUrl, |
| | | // emqUrl = mHome.emqUrl, |
| | | // homeRegionName = mHome.homeRegionName, |
| | | // homeRegionId = mHome.homeRegionId, |
| | | // Address = mHome.homeAddress, |
| | | // isAllowCreateScene = mHome.isAllowCreateScene, |
| | | //}; |
| | | if (home.isBindGateway) |
| | | { |
| | | UserInfo.Current.regionList.Add(home); |
| | | //新绑定的住宅,直接切换到新住宅 |
| | | if (!string.IsNullOrEmpty(homeId)) |
| | | { |
| | | if (homeId.Contains(home.id)) |
| | | { |
| | | DB_ResidenceData.Instance.CurrentRegion = home; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(UserInfo.Current.regionList.Count== 0) |
| | | if (UserInfo.Current.regionList.Count == 0) |
| | | { |
| | | return "null"; |
| | | } |
| | |
| | | GetHomeGatewayList(); |
| | | } |
| | | } |
| | | |
| | | #if __IOS__ |
| | | var sdm = new SiriKit.SceneDateManager(); |
| | | sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl; |
| | | sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; |
| | | #endif |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | else if (editId == 1) |
| | | { |
| | | requestObj.Address = editName; |
| | | requestObj.homeAddress = editName; |
| | | } |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(requestObj); |
| | |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 过户 |
| | | /// </summary> |
| | | /// <param name="i_account">对方账号</param> |
| | | /// <returns></returns> |
| | | public bool TransferResidence(string i_account) |
| | | { |
| | | var pra2 = new |
| | | { |
| | | homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id, |
| | | account = i_account |
| | | }; |
| | | var requestJson = HttpUtil.GetSignRequestJson(pra2); |
| | | var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_TransferResidence, requestJson); |
| | | |
| | | return result != null && result.Code == StateCode.SUCCESS; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 管理员权限迁移 |
| | | /// </summary> |
| | | /// <param name="i_childAccountId">成员账号id</param> |
| | | /// <returns></returns> |
| | | public bool AdminAuthorityMigration(string i_childAccountId) |
| | | { |
| | | var pra2 = new |
| | | { |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.id, |
| | | childAccountId = i_childAccountId |
| | | }; |
| | | var requestJson = HttpUtil.GetSignRequestJson(pra2); |
| | | var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_AdminAuthorityMigration, requestJson); |
| | | |
| | | return result != null && result.Code == StateCode.SUCCESS; |
| | | } |
| | | |
| | | #region 新数据分享 |
| | | /// <summary> |
| | | /// 添加分享 |
| | |
| | | |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_GetList, requestJson); |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | ///// <summary> |
| | |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("debugPerm", debugPerm); |
| | | string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString); |
| | | var jsonString = HttpUtil.GetSignRequestJson(d, d); |
| | | var pack = HttpUtil.RequestHttpsPost(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString); |
| | | return pack; |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | try |
| | | { |
| | | //先清空推送ID,避免使用缓存的PushId为其它账号的情况,导致查询到其它账号的推送记录 |
| | | OnAppConfig.Instance.PushId = ""; |
| | | |
| | | string deviceType = PhoneDeviceType.Android.ToString(); |
| | | #if __IOS__ |
| | | deviceType = PhoneDeviceType.IOS.ToString(); |
| | |
| | | isProduce = false; |
| | | #endif |
| | | |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) { |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) |
| | | { |
| | | Utlis.WriteLine("PushDeviceToken 为空"); |
| | | return false; |
| | | } |
| | |
| | | deviceName = OnAppConfig.Instance.PhoneName, |
| | | deviceType = deviceType, |
| | | produce = isProduce, |
| | | |
| | | }; |
| | | mAddpushinfoObj.languageType = Utlis.GetPostLanguageType(); |
| | | |
| | | #if DEBUG |
| | | //List<string> communityCodes = new List<string>(); |
| | | //communityCodes.Add(""); |
| | | //mAddpushinfoObj.communityCodes = communityCodes; |
| | | #endif |
| | | |
| | | //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj); |
| | | var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj); |
| | |
| | | OnAppConfig.Instance.PushId = pushId; |
| | | OnAppConfig.Instance.SaveConfig(); |
| | | Utlis.WriteLine("PushId: " + pushId); |
| | | |
| | | |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | else |
| | | { |
| | |
| | | /// <summary> |
| | | /// 查询推送信息列表 |
| | | /// </summary> |
| | | /// <param name="queryType">0全部 1分享与功能 2报警类 3系统信息</param> |
| | | /// <param name="queryType">0全部 1分享与功能 2报警类 3系统信息 4物业通知</param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew PushSerivceGetPushmessagelist(int queryType = 0) |
| | | { |
| | |
| | | { |
| | | pushType = PushType.Prompt.ToString(); |
| | | } |
| | | |
| | | else if (queryType == 4) |
| | | { |
| | | pushType = PushType.Notice.ToString(); |
| | | } |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj() |
| | | { |
| | | pushId = OnAppConfig.Instance.PushId, |
| | | pushType = pushType |
| | | pushType = pushType, |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.id, |
| | | }); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist, requestJson); |
| | | //2021-08-28 改为分页查询 |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist_Paging, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false; |
| | | try |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() |
| | | { |
| | | pushId = OnAppConfig.Instance.PushId |
| | | }); |
| | | |
| | | |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_DeleteToken, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | | { |
| | |
| | | /// </summary> |
| | | /// <param name="msgId"></param> |
| | | /// <returns></returns> |
| | | public bool PushSerivceDeleteMessage(string msgId) |
| | | public bool PushSerivceDeleteMessage(PushMsgIdObj mPushMsgIdObj) |
| | | { |
| | | if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false; |
| | | |
| | | if (mPushMsgIdObj == null) return false; |
| | | try |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new PushMsgIdObj() |
| | | { |
| | | msgId = msgId |
| | | }); |
| | | var requestJson = HttpUtil.GetSignRequestJson(mPushMsgIdObj); |
| | | |
| | | var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Deletepushinfo, requestJson); |
| | | if (revertObj.Code == StateCode.SUCCESS) |
| | |
| | | { IsBackground = true }.Start(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取物业公告详情 |
| | | /// </summary> |
| | | /// <param name="noticeId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetPropertyNoticeDetails(string noticeId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("noticeId", noticeId); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_GetNoticeInfo, requestJson); |
| | | } |
| | | #endregion |
| | | |
| | | #region 检测更新 |
| | |
| | | |
| | | #region 获取天气部分 |
| | | /// <summary> |
| | | /// 获取指定经纬度的城市信息 |
| | | /// 获取指定经纬度的城市信息天气信息 |
| | | /// </summary> |
| | | public void GetCityInfo(string lon, string lat) |
| | | public void GetCityWeatherInfo(string lon, string lat) |
| | | { |
| | | System.Threading.Tasks.Task.Run(() => |
| | | { |
| | |
| | | MainPage.cityInfo.pm25 = jt.GetValue("Air_Quality").ToString(); |
| | | MainPage.cityInfo.windLevel = jt.GetValue("WindLevel").ToString(); |
| | | MainPage.cityInfo.weather = jt.GetValue("Weather").ToString(); |
| | | MainPage.cityInfo.lowestTemperature = jt.GetValue("lowestTemperature").ToString(); |
| | | MainPage.cityInfo.highestTemperature = jt.GetValue("highestTemperature").ToString(); |
| | | |
| | | break; |
| | | } |
| | | catch (Exception ex) |
| | |
| | | }); |
| | | }); |
| | | } |
| | | ///// <summary> |
| | | ///// 获取指定经纬度的城市信息 |
| | | ///// </summary> |
| | | ///// <param name="lon"></param> |
| | | ///// <param name="lat"></param> |
| | | //public void GetCityInfo() |
| | | //{ |
| | | // if (DB_ResidenceData.Instance.CurrentRegion.longitude == 0 && DB_ResidenceData.Instance.CurrentRegion.latitude == 0) |
| | | // { |
| | | // return; |
| | | // } |
| | | // string lon = DB_ResidenceData.Instance.CurrentRegion.longitude.ToString(); |
| | | // string lat = DB_ResidenceData.Instance.CurrentRegion.latitude.ToString(); |
| | | // System.Threading.Tasks.Task.Run(() => |
| | | // { |
| | | // while (true) |
| | | // { |
| | | // var webClient = new WebClient(); |
| | | // string url = $"https://developer.hdlcontrol.com/Weather/Weather/FindCity/?lon={lon}&lat={lat}"; |
| | | // string responseString = null; |
| | | // try |
| | | // { |
| | | // responseString = Encoding.UTF8.GetString(webClient.DownloadData(url)); |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log(ex.Message); |
| | | // } |
| | | |
| | | // if (responseString != null) |
| | | // { |
| | | // try |
| | | // { |
| | | // var revertObj = Newtonsoft.Json.JsonConvert.DeserializeObject<ResponsePack>(responseString); |
| | | // JObject jt = Newtonsoft.Json.JsonConvert.DeserializeObject<JObject>(revertObj.ResponseData.ToString()); |
| | | |
| | | // DB_ResidenceData.cityInfo.location = jt.GetValue("Location").ToString(); |
| | | // DB_ResidenceData.cityInfo.province = jt.GetValue("Province").ToString(); |
| | | // DB_ResidenceData.cityInfo.country = jt.GetValue("Country").ToString(); |
| | | // DB_ResidenceData.cityInfo.timeZone = jt.GetValue("TimeZone").ToString(); |
| | | // DB_ResidenceData.Instance.SaveResidenceData(); |
| | | |
| | | // return; |
| | | // } |
| | | // catch (Exception ex) |
| | | // { |
| | | // MainPage.Log($"get weather error : {ex.Message}"); |
| | | // } |
| | | // } |
| | | // } |
| | | // }); |
| | | //} |
| | | |
| | | |
| | | #endregion |
| | | |
| | |
| | | var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d); |
| | | var revertObj = RequestHttps("https://developer.hdlcontrol.com/api/UserBackupList", requestJson, true); |
| | | var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(revertObj.ResponseData.ToString()); |
| | | #region 恢复房间数据 |
| | | #region 恢复房间数据 |
| | | |
| | | |
| | | GetBackupRoom(jt,loading); |
| | | #endregion |
| | | #endregion |
| | | |
| | | Application.RunOnMainThread(() => { |
| | | loading.Hide(); |
| | |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("productPlatform", productPlatform); |
| | | d.Add("productBrand", productBrand); |
| | | d.Add("networkConfig", true); |
| | | if (productBrand != "MegaHealth") |
| | | { |
| | | d.Add("networkConfig", true); |
| | | } |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson); |
| | |
| | | /// <param name="productPlatform"></param> |
| | | /// <param name="productBrand"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew Get3TyBrandDeviceList(string productPlatform,string productBrand) |
| | | public ResponsePackNew Get3TyBrandDeviceList(string productPlatform, string productBrand) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("categoryType", 1); |
| | | d.Add("productPlatform", productPlatform); |
| | | d.Add("productBrand", productBrand); |
| | | d.Add("networkConfig", true); |
| | | |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson); |
| | | } |
| | | /// <summary> |
| | | /// 注册第三方设备 |
| | | /// </summary> |
| | | /// <param name="productPlatform"></param> |
| | | /// <param name="productBrand"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew IndependentRegister3TyDevcie(string spk, string extDevId, string deviceName, string pairCode = "") |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("spk", spk); |
| | | d.Add("extDevId", extDevId); |
| | | d.Add("name", deviceName); |
| | | d.Add("code", pairCode); |
| | | |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_IndependentRegister3TyDevcie, requestJson); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取设备详情 |
| | |
| | | d.Add("actions", actionObjs); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | MainPage.Log($"{requestJson}"); |
| | | MainPage.Log($"api功能控制:{requestJson}"); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlDevice, requestJson); |
| | | } |
| | | /// <summary> |
| | |
| | | /// <summary> |
| | | /// 设备绑定房间 |
| | | /// </summary> |
| | | public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds) |
| | | public ResponsePackNew BindDeviceToRoom(List<string> deviceIds, List<string> roomIds) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("deviceIds",new List<string>() { deviceId }); |
| | | d.Add("deviceIds", new List<string>() { deviceId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectDevice, requestJson); |
| | |
| | | public ResponsePackNew GetSceneInfo(string seceneId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("userSceneIds",new List<string>() { seceneId }); |
| | | d.Add("userSceneIds", new List<string>() { seceneId }); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson); |
| | |
| | | d.Add("pageSize", "1000"); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson); |
| | | |
| | | |
| | | return pack; |
| | | } |
| | | /// <summary> |
| | |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("securitys", securityStates); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | MainPage.Log($"api安防控制:{requestJson}"); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_StatusSet, requestJson); |
| | | return pack; |
| | | } |
| | |
| | | /// <summary> |
| | | /// 查询安防所有记录 |
| | | /// </summary> |
| | | public ResponsePackNew GetSecurityLogList(string pageSize,string pageNo) |
| | | public ResponsePackNew GetSecurityLogList(string pageSize, string pageNo) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | |
| | | |
| | | #endregion |
| | | |
| | | #region 萤石云SDK相关接口 |
| | | #region ■ 萤石云SDK相关接口_________________________ |
| | | /// <summary> |
| | | /// 河东获取萤石云子账号token的接口 |
| | | /// 2021-07-07 新方案接口调整对接 |
| | | /// </summary> |
| | | public ResponsePackNew EZGetChildToken() |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("platform", "1"); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson); |
| | | } |
| | | #endregion |
| | | |
| | | |
| | | #region 可视对讲 |
| | | #region ■ 可视对讲_________________________ |
| | | /// <summary> |
| | | /// 检查住宅是否绑定丰林,并获取门口机列表 |
| | | /// 检查住宅是否绑定丰林 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew CheckFlVideo() |
| | |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson); |
| | | var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Check, requestJson); |
| | | return pack; |
| | | } |
| | | #endregion |
| | | |
| | | #region ■ 门锁相关____________________________ |
| | | |
| | | /// <summary> |
| | | /// 获取门锁历史记录(按日期降序) |
| | | /// </summary> |
| | | /// <param name="i_device">设备对象</param> |
| | | /// <returns></returns> |
| | | public List<Stan.DoorHistoryLog> GetDoorHistoryLogs(Function i_device) |
| | | { |
| | | //var dicPra = new Dictionary<string, object>(); |
| | | //dicPra.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | //dicPra.Add("deviceId", i_device.deviceId); |
| | | //dicPra.Add("logType", "OPEN_DOOR"); |
| | | //dicPra.Add("pageSize", "200"); |
| | | //var requestJson = HttpUtil.GetSignRequestJson(dicPra); |
| | | //var packData = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_DoorHistory, requestJson); |
| | | //if (packData.Code != StateCode.SUCCESS) |
| | | //{ |
| | | // return null; |
| | | //} |
| | | |
| | | |
| | | //测试 |
| | | var listLog = new List<Stan.DoorHistoryLog>(); |
| | | for (int i = 1; i <= 3; i++) |
| | | { |
| | | var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" }; |
| | | logInfo.Time = new DateTime(2000, 5, 6, 10, 45, 23).AddDays(i); |
| | | listLog.Add(logInfo); |
| | | } |
| | | for (int i = 1; i <= 3; i++) |
| | | { |
| | | var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" }; |
| | | logInfo.Time = new DateTime(2001, 5, 6, 10, 45, 23).AddDays(i); |
| | | listLog.Add(logInfo); |
| | | } |
| | | for (int i = 1; i <= 3; i++) |
| | | { |
| | | var logInfo = new Stan.DoorHistoryLog { StrMsg = "电量低,请更换电池" }; |
| | | logInfo.Time = new DateTime(2002, 5, 6, 10, 45, 23).AddDays(i); |
| | | listLog.Add(logInfo); |
| | | } |
| | | |
| | | //按时间降序 |
| | | var listSortLog = new List<Stan.DoorHistoryLog>(); |
| | | foreach (var logInfo in listLog) |
| | | { |
| | | bool canAdd = true; |
| | | for (int i = 0; i < listSortLog.Count; i++) |
| | | { |
| | | if (logInfo.Time > listSortLog[i].Time) |
| | | { |
| | | //时间比当前的索引大,则插入到它的前面 |
| | | listSortLog.Insert(i, logInfo); |
| | | canAdd = false; |
| | | break; |
| | | } |
| | | } |
| | | if (canAdd == true) |
| | | { |
| | | //日期最小,则添加到末尾 |
| | | listSortLog.Add(logInfo); |
| | | } |
| | | } |
| | | //提示 |
| | | //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code); |
| | | return listSortLog; |
| | | } |
| | | |
| | | #endregion |
| | | #region ■ 音箱语言控制相关_________________________ |
| | | /// <summary> |
| | | /// 获取已授权的音箱列表 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetSpeakerList() |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(new GetSpeakerObj |
| | | { |
| | | homeId = DB_ResidenceData.Instance.CurrentRegion.id, |
| | | }); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_List_Get, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 编辑音箱授权备注 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew UpdateSpeakerRemark(UpdateSpeakerRemarkObj remarkObj) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(remarkObj); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Remark_Update, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 解除音箱绑定 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew UnbindSpeaker(string tokenId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("tokenId", tokenId); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_Unbind, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获取音箱分配的设备和场景列表 |
| | | /// </summary> |
| | | /// <param name="getType">0 是查询全部 1是查询设备 2是查询场景</param> |
| | | /// <param name="tokenId"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetSpeakerDeviceList(int getType, string tokenId) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("tokenId", tokenId); |
| | | if (getType > 0) |
| | | { |
| | | d.Add("isDevice", getType == 1); |
| | | } |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Get, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 更新音箱控制的设备和场景目标 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew UpdateSpeakerDeviceList(UpdateSpeakerDeviceListObj updateSpeakerDeviceListObj) |
| | | { |
| | | var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson); |
| | | } |
| | | #endregion |
| | | |
| | | /// <summary> |
| | | /// 绑定source面板 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew BindSourcePanel(string qrString) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("content", qrString); |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_BindSourcePanel, requestJson); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 人脸录入 |
| | | /// </summary> |
| | | /// <param name="imageBytes"></param> |
| | | /// <returns></returns> |
| | | public ResponsePackNew FaceSetting(string imageBytes) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("userFace", @"data:image/jpg;base64," + imageBytes); |
| | | d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | |
| | | //MainPage.Log(imageBytes); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_InputUserFace, requestJson); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 修改住户人脸关闭状态 |
| | | /// 1:开启状态 2:关闭状态 |
| | | /// 3:清除人脸数据 |
| | | /// </summary> |
| | | public ResponsePackNew EditFaceFunction(int status) |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | d.Add("faceClose", status); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SwitchFaceFunction, requestJson); |
| | | } |
| | | |
| | | |
| | | /// <summary> |
| | | /// 获取住户详情 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public ResponsePackNew GetCustomerInfo() |
| | | { |
| | | Dictionary<string, object> d = new Dictionary<string, object>(); |
| | | d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id); |
| | | |
| | | var requestJson = HttpUtil.GetSignRequestJson(d); |
| | | return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetCustomerInfo, requestJson); |
| | | } |
| | | } |
| | | } |