From ccdff82fac4bcc1067ec806ade5ae897f1214f4d Mon Sep 17 00:00:00 2001 From: wei <kaede@kaededeMacBook-Air.local> Date: 星期四, 01 四月 2021 14:41:53 +0800 Subject: [PATCH] 异常捕获 --- HDL_ON/DAL/Server/HttpServerRequest.cs | 157 +++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 124 insertions(+), 33 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs old mode 100755 new mode 100644 index 369d632..d693f04 --- a/HDL_ON/DAL/Server/HttpServerRequest.cs +++ b/HDL_ON/DAL/Server/HttpServerRequest.cs @@ -37,34 +37,48 @@ { } + #region kaede ___________浼犳劅鍣ㄥ巻鍙叉暟鎹甠_________________ /// <summary> /// 鑾峰彇浼犳劅鍣ㄥ巻鍙叉暟鎹� /// </summary> - /// <param name="subnetId"></param> - /// <param name="deviceId"></param> - /// <param name="bigClass"></param> - /// <param name="minClass"></param> - /// <param name="queryType"></param> - /// <param name="loopId"></param> - /// <param name="nowMonth"></param> - /// <param name="mac"></param> + /// <param name="qType">鏃堕棿鏌ヨ绫诲瀷锛歨our=杩�24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈� </param> + /// <param name="deviceId">璁惧ID</param> + /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param> /// <returns></returns> - public ResponsePack GetSensorHistory(int subnetId, int deviceId, int bigClass, int minClass, int queryType, int loopId, int nowMonth, string mac) + public ResponsePackNew GetSensorHistory(string qType, string deviceId,string deviceKey) { Dictionary<string, object> d = new Dictionary<string, object>(); - d.Add("SubnetID", subnetId); - d.Add("DeviceID", deviceId); - d.Add("LargeType", bigClass); - d.Add("SmallType", minClass); - d.Add("QueryType", queryType); - d.Add("loopId", loopId); - d.Add("NowMonth", nowMonth); - d.Add("MAC", DB_ResidenceData.Instance.residenceGatewayMAC); - d.Add("LocalTimeZone", 8); - var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); - return RequestHttps("https://developer.hdlcontrol.com/api/GetSensorPushHistory", jsonString, true); + d.Add("type", qType); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("deviceId", new List<string>() { deviceId }); + d.Add("key", new List<string>() { deviceKey }); + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson); } + /// <summary> + /// 鑾峰彇瀹夐槻浼犳劅鍣ㄥ巻鍙叉暟鎹� + /// </summary> + /// <param name="deviceId">璁惧ID</param> + /// <param name="pageSize">椤甸潰澶у皬</param> + /// <param name="pageNo">椤靛彿</param> + /// <returns></returns> + public ResponsePackNew GetArmSensorHistory( string deviceId,string pageSize, string pageNo) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("deviceId", deviceId); + d.Add("pageSize", pageSize); + d.Add("pageNo", pageNo); + + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson); + } + + + + + #endregion //public string GetRequestResultMsg(string resultCode) //{ @@ -466,6 +480,7 @@ IsOthreShare = mHome.IsOtherShare, accountType = mHome.accountType, isRemoteControl = mHome.isRemoteControl, + isBindGateway = mHome.isBindGateway, longitude = mHome.longitude, latitude = mHome.latitude, deliverstatus = mHome.deliverstatus, @@ -477,7 +492,14 @@ Address = mHome.homeAddress, isAllowCreateScene = mHome.isAllowCreateScene, }; - UserInfo.Current.regionList.Add(home); + if (home.isBindGateway) + { + UserInfo.Current.regionList.Add(home); + } + } + if(UserInfo.Current.regionList.Count== 0) + { + return "null"; } //-------濡傛灉璐﹀彿鏄娆$櫥褰� if (DB_ResidenceData.Instance.CurrentRegion == null || string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) @@ -571,14 +593,7 @@ if (mHomeGatewayRes.Count > 0) { DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0]; - //if (mHomeGatewayRes[0].gatewayStatus) - //{ - // DriverLayer.Control.Ins.GatewayOnline = true; - //} - //else - //{ - // DriverLayer.Control.Ins.GatewayOnline = false; - //} + DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus; DB_ResidenceData.Instance.SaveResidenceData(); return revertObj.Code; } @@ -604,6 +619,8 @@ /// </summary> public string GetGatewayInfo() { + if (DB_ResidenceData.Instance.HomeGateway == null) + return StateCode.NETWORK_ERROR; Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId); @@ -614,10 +631,7 @@ var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString()); if (mHomeGatewayRes != null) { - if(mHomeGatewayRes.gatewayStatus) - { - DriverLayer.Control.Ins.GatewayOnline = true; - } + DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus; } } return revertObj.Code; @@ -1775,6 +1789,56 @@ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson); } /// <summary> + /// 鑾峰彇鎸囧畾绗笁鏂瑰搧鐗岀殑缁戝畾杩囩殑璁惧鍒楄〃 + /// </summary> + /// <param name="productPlatform"></param> + /// <param name="productBrand"></param> + /// <returns></returns> + public ResponsePackNew Get3TyBrandBindDeviceList(string productPlatform, string productBrand) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("productPlatform", productPlatform); + d.Add("productBrand", productBrand); + d.Add("networkConfig", true); + + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson); + } + /// <summary> + /// 鑾峰彇鎸囧畾绗笁鏂瑰搧鐗岀殑璁惧鍒楄〃 + /// </summary> + /// <param name="productPlatform"></param> + /// <param name="productBrand"></param> + /// <returns></returns> + 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> + /// <returns></returns> + public ResponsePackNew GetDeviceInfo(string functionId) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("deviceIds", new List<string>() { functionId }); + + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson); + } + + /// <summary> /// 鑾峰彇璁惧璇︽儏鍒楄〃 /// </summary> /// <returns></returns> @@ -2154,5 +2218,32 @@ #endregion + #region 钀ょ煶浜慡DK鐩稿叧鎺ュ彛 + /// <summary> + /// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙� + /// </summary> + public ResponsePackNew EZGetChildToken() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson); + } + #endregion + + + #region 鍙瀵硅 + /// <summary> + /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋楋紝骞惰幏鍙栭棬鍙f満鍒楄〃 + /// </summary> + /// <returns></returns> + public ResponsePackNew CheckFlVideo() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson); + return pack; + } + #endregion } } \ No newline at end of file -- Gitblit v1.8.0