From e71c57108e6dd407c2c6f0361f68150f2ff9aed5 Mon Sep 17 00:00:00 2001 From: wxr <464027401@qq.com> Date: 星期三, 15 十二月 2021 13:41:16 +0800 Subject: [PATCH] 版本备份 --- HDL_ON/DAL/Server/HttpServerRequest.cs | 256 +++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 215 insertions(+), 41 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index 0944506..2414895 100644 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -45,13 +45,13 @@ /// <param name="deviceId">璁惧ID</param> /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</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", deviceId ); - d.Add("key", deviceKey ); + d.Add("deviceId", deviceId); + d.Add("key", deviceKey); var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); @@ -63,7 +63,7 @@ /// <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); @@ -78,7 +78,7 @@ /// 璇诲彇鏈�杩戜竴涓湀鐨勬暟鎹� /// </summary> /// <returns></returns> - public ResponsePackNew GetLastMonthHistory(string deviceId,string key) + public ResponsePackNew GetLastMonthHistory(string deviceId, string key) { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); @@ -146,6 +146,12 @@ 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; } @@ -234,7 +240,19 @@ 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> @@ -251,7 +269,19 @@ 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> @@ -264,7 +294,7 @@ /// <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; @@ -345,7 +375,7 @@ 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; @@ -482,7 +512,7 @@ /// <summary> /// 鑾峰彇浣忓畢鍒楄〃 /// </summary> - public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL,string homeId = "") + 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); @@ -510,7 +540,7 @@ } } } - if(UserInfo.Current.regionList.Count== 0) + if (UserInfo.Current.regionList.Count == 0) { return "null"; } @@ -553,6 +583,12 @@ GetHomeGatewayList(); } } + +#if __IOS__ + var sdm = new SiriKit.SceneDateManager(); + sdm.RegionUrl = DB_ResidenceData.Instance.CurrentRegion.regionUrl; + sdm.HomeId = DB_ResidenceData.Instance.CurrentRegion.id; +#endif } } @@ -785,7 +821,7 @@ return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Share_GetList, requestJson); } - + #endregion ///// <summary> @@ -934,7 +970,7 @@ Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id); d.Add("debugPerm", debugPerm); - var jsonString = HttpUtil.GetSignRequestJson(d,d); + var jsonString = HttpUtil.GetSignRequestJson(d, d); var pack = HttpUtil.RequestHttpsPost(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString); return pack; } @@ -993,7 +1029,8 @@ isProduce = false; #endif - if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) { + if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) + { Utlis.WriteLine("PushDeviceToken 涓虹┖"); return false; } @@ -1004,7 +1041,15 @@ 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); @@ -1019,11 +1064,11 @@ OnAppConfig.Instance.PushId = pushId; OnAppConfig.Instance.SaveConfig(); Utlis.WriteLine("PushId: " + pushId); - + return true; } } - + } else { @@ -1041,7 +1086,7 @@ /// <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) { @@ -1059,14 +1104,18 @@ { pushType = PushType.Prompt.ToString(); } - + else if (queryType == 4) + { + pushType = PushType.Notice.ToString(); + } var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj() { pushId = OnAppConfig.Instance.PushId, 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> @@ -1103,10 +1152,11 @@ 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) { @@ -1194,16 +1244,13 @@ /// </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) @@ -1262,6 +1309,18 @@ { 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 妫�娴嬫洿鏂� @@ -1286,9 +1345,9 @@ #region 鑾峰彇澶╂皵閮ㄥ垎 /// <summary> - /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅 + /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅澶╂皵淇℃伅 /// </summary> - public void GetCityInfo(string lon, string lat) + public void GetCityWeatherInfo(string lon, string lat) { System.Threading.Tasks.Task.Run(() => { @@ -1351,6 +1410,59 @@ }); }); } + ///// <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 @@ -1401,11 +1513,11 @@ 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(); @@ -1873,14 +1985,14 @@ /// <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); } @@ -1890,13 +2002,15 @@ /// <param name="productPlatform"></param> /// <param name="productBrand"></param> /// <returns></returns> - public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName) + 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); @@ -1959,7 +2073,7 @@ 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> @@ -1998,7 +2112,7 @@ /// <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); @@ -2041,7 +2155,7 @@ { 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); @@ -2088,7 +2202,7 @@ 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); @@ -2212,7 +2326,7 @@ d.Add("pageSize", "1000"); var requestJson = HttpUtil.GetSignRequestJson(d); var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson); - + return pack; } /// <summary> @@ -2375,6 +2489,7 @@ 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; } @@ -2412,7 +2527,7 @@ /// <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); @@ -2492,7 +2607,7 @@ 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 @@ -2633,5 +2748,64 @@ } #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); + } } } \ No newline at end of file -- Gitblit v1.8.0