From df8d4ab0ef17a7fab5dea9c47bbd9f4d4a2a40b0 Mon Sep 17 00:00:00 2001 From: 黄学彪 <hxb@hdlchina.com.cn> Date: 星期一, 15 三月 2021 14:55:49 +0800 Subject: [PATCH] 合并前上传一个版本 --- HDL_ON/DAL/Server/HttpServerRequest.cs | 146 +++++++++++++++++++++++++++++++++++------------- 1 files changed, 107 insertions(+), 39 deletions(-) diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs index e31e88c..63a7ec2 100644 --- 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) //{ @@ -503,7 +517,7 @@ UserInfo.Current.SaveUserInfo(); Action action = () => { - MainPage.GoUserPage(); + MainPage.GoUserPage(true); }; new UI.PublicAssmebly().TipMsg(StringId.Tip, StringId.ResidenceDeletedSwitchToAnotherResidence, action); }); @@ -553,11 +567,11 @@ /// <summary> /// 鑾峰彇鍒锋柊褰撳墠浣忓畢鐨勭綉鍏冲垪琛� /// </summary> - public void GetHomeGatewayList() + public string GetHomeGatewayList() { try { - if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) return; + if (string.IsNullOrEmpty(DB_ResidenceData.Instance.CurrentRegion.RegionID)) return ""; var nowhomeId = DB_ResidenceData.Instance.CurrentRegion.RegionID; var requestJson = HttpUtil.GetSignRequestJson(new HomeIdObj() { homeId = nowhomeId }); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_GetGatewayList, requestJson); @@ -571,17 +585,9 @@ if (mHomeGatewayRes.Count > 0) { DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0]; - if(mHomeGatewayRes[0].gatewayStatus) - { - //DriverLayer.Control.Ins.IsRemote = true; - DriverLayer.Control.Ins.GatewayOnline = true; - } - else - { - DriverLayer.Control.Ins.GatewayOnline = false; - } + DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus; DB_ResidenceData.Instance.SaveResidenceData(); - return; + return revertObj.Code; } } //鍏朵綑鎯呭喌娓呯┖缃戝叧淇℃伅 @@ -593,10 +599,11 @@ { //鎻愮ず閿欒 } + return revertObj.Code; } catch { - + return ""; } } /// <summary> @@ -604,18 +611,19 @@ /// </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); - string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d); + var jsonString = HttpUtil.GetSignRequestJson(d); var revertObj = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGatewayInfo, jsonString); if (revertObj.Code == StateCode.SUCCESS) { var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString()); if (mHomeGatewayRes != null) { - DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes; - DB_ResidenceData.Instance.SaveResidenceData(); + DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus; } } return revertObj.Code; @@ -1808,7 +1816,7 @@ { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); - d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId); + d.Add("gatewayId", DB_ResidenceData.Instance.HomeGateway == null ? "0" : DB_ResidenceData.Instance.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId); d.Add("actions", actionObjs); var requestJson = HttpUtil.GetSignRequestJson(d); @@ -1823,7 +1831,7 @@ { Dictionary<string, object> d = new Dictionary<string, object>(); d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); - d.Add("deviceId", function.deviceId);//DriverLayer.Control.Ins.GatewayId); + d.Add("deviceId", function.deviceId); d.Add("name", function.name); d.Add("collect", function.collect); d.Add("roomIds", function.roomIds); @@ -1831,6 +1839,22 @@ var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson); } + /// <summary> + /// 鏇存柊璁惧缁戝畾鎴块棿淇℃伅 + /// </summary> + /// <returns></returns> + public ResponsePackNew UpdataDevcieBindRoomInfo(Function function) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.RegionID); + d.Add("deviceId", function.deviceId); + d.Add("roomIds", function.roomIds); + + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson); + } + + /// <summary> /// 璁惧缁戝畾鎴块棿 /// </summary> @@ -1929,6 +1953,21 @@ var requestJson = HttpUtil.GetSignRequestJson(d); return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson); } + + /// <summary> + /// 鑾峰彇鍦烘櫙璇︽儏鍒楄〃 + /// </summary> + /// <param name="seceneId">鍦烘櫙ID</param> + /// <returns></returns> + public ResponsePackNew GetSceneListInfo(List<string> seceneIds) + { + Dictionary<string, object> d = new Dictionary<string, object>(); + d.Add("userSceneIds", seceneIds); + + var requestJson = HttpUtil.GetSignRequestJson(d); + return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneInfo, requestJson); + } + /// <summary> /// 娣诲姞鍦烘櫙 /// </summary> @@ -2092,5 +2131,34 @@ } #endregion + + + #region Kaede --鎴块棿鍔熻兘-------------------------- + /// <summary> + /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛� + /// </summary> + public ResponsePackNew Get3tyBrandList() + { + Dictionary<string, object> d = new Dictionary<string, object>(); + var requestJson = HttpUtil.GetSignRequestJson(d); + var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetBrandList, requestJson); + + return pack; + } + /// <summary> + /// 鑾峰彇缁戝畾鐨勭涓夋柟鍝佺墝鍒楄〃 + /// </summary> + public ResponsePackNew Get3tyBindBrandList() + { + 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_GetBindBrandList, requestJson); + + return pack; + } + + #endregion + } } \ No newline at end of file -- Gitblit v1.8.0