From 3e7c0a6deda128e639abfa3b8ed9377dbd017526 Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期五, 11 十二月 2020 17:47:24 +0800
Subject: [PATCH] 2020-12-11-4
---
HDL_ON/DAL/Server/HttpServerRequest.cs | 150 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 112 insertions(+), 38 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index e8ec927..c3f59a6 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -99,7 +99,7 @@
public ResponsePackNew GetRegionByAccount(string account)
{
var requestJson = HttpUtil.GetSignRequestJson(new RegionByAccountObj() { account = account });
- return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson);
+ return HttpUtil.RequestHttpsPost(NewAPI.API_POST_GetRegionByAccount, requestJson, HttpUtil.GlobalRequestHttpsHost);
}
/// <summary>
@@ -636,6 +636,11 @@
if (mHomeGatewayRes.Count > 0)
{
DB_ResidenceData.residenceData.HomeGateway = mHomeGatewayRes[0];
+ if(mHomeGatewayRes[0].gatewayStatus == "ON_LINE")
+ {
+ DriverLayer.Control.Ins.IsRemote = true;
+ DriverLayer.Control.Ins.GatewayOnline = true;
+ }
DB_ResidenceData.residenceData.SaveResidenceData();
return;
}
@@ -1249,8 +1254,12 @@
#region 鑾峰彇澶╂皵閮ㄥ垎
/// <summary>
+ /// /// <summary>
/// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅
/// </summary>
+ /// </summary>
+ /// <param name="lon">缁忓害</param>
+ /// <param name="lat">绾害</param>
public void GetCityInfo(string lon, string lat)
{
System.Threading.Tasks.Task.Run(() =>
@@ -1798,13 +1807,14 @@
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ //d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);
//d.Add("roomId", DB_ResidenceData.residenceData.residecenInfo.RegionID);//鍙帶鍙傛暟锛屽綋闇�瑕佸垎椤佃幏鍙栵紝鎬庝箞鐭ラ亾鍒嗛〉鎬绘暟
//d.Add("searchType", DB_ResidenceData.residenceData.residecenInfo.RegionID);
//d.Add("pageSize", DB_ResidenceData.residenceData.residecenInfo.RegionID);
//d.Add("pageNo", DB_ResidenceData.residenceData.residecenInfo.RegionID);
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetDevcieList, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
}
/// <summary>
/// 鑾峰彇璁惧璇︽儏鍒楄〃
@@ -1817,8 +1827,22 @@
d.Add("deviceIds", functionIds);
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetDevcieInfoList, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieInfoList, requestJson);
}
+ /// <summary>
+ /// 鍒锋柊璁惧鐘舵��
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew RefreshDeviceStatus(List<string> functionIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ d.Add("deviceIds", functionIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_RefreshDeviceStatus, requestJson);
+ }
+
/// <summary>
/// 鎺у埗璁惧
/// </summary>
@@ -1827,11 +1851,28 @@
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- d.Add("gatewayId", DriverLayer.Control.Ins.GatewayId);
+ d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId);
d.Add("actions", actionObjs);
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ControlDevice, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlDevice, requestJson);
+ }
+ /// <summary>
+ /// 缂栬緫璁惧淇℃伅
+ /// 缁戝畾鍏崇郴銆佸悕绉般�佹敹钘�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew UpdataDevcieInfo(Function function)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ d.Add("gatewayId", DB_ResidenceData.residenceData.HomeGateway.gatewayId);//DriverLayer.Control.Ins.GatewayId);
+ d.Add("name", function.name);
+ d.Add("collect", function.collect);
+ d.Add("roomIds", function.roomIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
}
/// <summary>
/// 璁惧缁戝畾鎴块棿
@@ -1844,7 +1885,7 @@
d.Add("roomIds", new List<string>() { roomId});
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_BindDeviceToRoom, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_BindDeviceToRoom, requestJson).Code;
}
/// <summary>
/// 璁惧瑙g粦鎴块棿
@@ -1857,7 +1898,7 @@
d.Add("roomIds", new List<string>() { roomId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_UnbindDeviceToRoom, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UnbindDeviceToRoom, requestJson).Code;
}
/// <summary>
/// 璁惧鍚嶇О淇敼
@@ -1870,31 +1911,31 @@
d.Add("name", deviceName);
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EditDeviceName, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDeviceName, requestJson).Code;
}
/// <summary>
/// 鏀惰棌璁惧
/// </summary>
- public string CollectDevice(string deviceId)
+ public ResponsePackNew CollectDevice(string deviceId)
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- d.Add("deviceId",new List<string>() { deviceId });
+ d.Add("deviceIds",new List<string>() { deviceId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_CollectDevice, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectDevice, requestJson);
}
/// <summary>
/// 鍙栨秷鏀惰棌璁惧
/// </summary>
- public string CancelCollectDevice(string deviceId)
+ public ResponsePackNew CancelCollectDevice(string deviceId)
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- d.Add("deviceId", new List<string>() { deviceId });
+ d.Add("deviceIds", new List<string>() { deviceId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_CancelCollectDevice, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson);
}
#endregion
@@ -1916,7 +1957,7 @@
}
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetSecneList, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
}
/// <summary>
/// 鑾峰彇鍦烘櫙璇︽儏
@@ -1929,7 +1970,7 @@
d.Add("userSceneIds",new List<string>() { seceneId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetSecneList, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
}
/// <summary>
/// 娣诲姞鍦烘櫙
@@ -1938,10 +1979,11 @@
public ResponsePackNew AddScene(Scene scene)
{
Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
d.Add("scenes", new List<Scene>() { scene });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EditSecne, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddSecne, requestJson);
}
/// <summary>
/// 缂栬緫鍦烘櫙
@@ -1955,7 +1997,7 @@
d.Add("scenes", new List<Scene>() { scene });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EditSecne, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditSecne, requestJson);
}
/// <summary>
/// 鍒犻櫎鍦烘櫙
@@ -1968,7 +2010,7 @@
d.Add("userSceneIds", new List<string>() { userSceneId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_DeleteSecne, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DeleteSecne, requestJson).Code;
}
/// <summary>
/// 鎵ц鍦烘櫙
@@ -1981,7 +2023,7 @@
d.Add("userSceneIds", new List<string>() { userSceneId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ExecuteSecne, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ExecuteSecne, requestJson).Code;
}
/// <summary>
/// 鏀惰棌鍦烘櫙
@@ -1995,7 +2037,7 @@
d.Add("userSceneIds", new List<string>() { userSceneId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_CollectScene, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CollectScene, requestJson).Code;
}
/// <summary>
/// 鍙栨秷鏀惰棌鍦烘櫙
@@ -2009,7 +2051,7 @@
d.Add("userSceneIds", new List<string>() { userSceneId });
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_CancelCollectScene, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code;
}
#endregion
@@ -2017,42 +2059,74 @@
/// <summary>
/// 鑾峰彇鎴块棿鍒楄〃
/// </summary>
+ /// <param name="GetType">鑾峰彇绫诲瀷锛歊OOM\FLOOR;涓嶈緭鍏ヨ繑鍥炲叏閮�</param>
/// <returns></returns>
- public ResponsePackNew GetRoomList()
+ public ResponsePackNew GetRoomList(string GetType = "All")
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
-
+ if (GetType != "All")
+ {
+ d.Add("roomType", GetType);
+ }
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetRoomList, requestJson);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetRoomList, requestJson);
+
+ return pack;
}
/// <summary>
- /// 娣诲姞鎴块棿
+ /// 娣诲姞鎴块棿\妤煎眰
/// 妤煎眰涔熷睘浜庢埧闂�
/// </summary>
/// <returns></returns>
- public ResponsePackNew AddRoom(List<Room> rooms)
+ public ResponsePackNew AddRoom(List<SpatialInfo> rooms)
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- foreach(var room in rooms)
- {
- Dictionary<string, string> d1 = new Dictionary<string, string>();
- d1.Add("roomName", room.name);
- d1.Add("roomType", "ROOM");
- //d1.
- }
+ d.Add("rooms", rooms);
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_AddRoom, requestJson);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_AddRoom, requestJson);
+ //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(pack.Data.ToString());
+ //if (revData != null)
+ //{
+ // SpatialInfo.CurrentSpatial.UpdateSpatialList(revData, OptionType.Update);
+ //}
+ return pack;
}
/// <summary>
- /// 娣诲姞妤煎眰
+ /// 淇敼鎴块棿淇℃伅
/// </summary>
/// <returns></returns>
- public ResponsePackNew AddFloor()
+ public ResponsePackNew UpdateRoom(List<SpatialInfo> rooms)
{
- return null;
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ d.Add("rooms", rooms);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_UpdateRoom, requestJson);
+ //var revData = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SpatialInfo>>(pack.Data.ToString());
+ //if (revData != null)
+ //{
+ // SpatialInfo.CurrentSpatial.UpdateSpatialList(revData,OptionType.Update);
+ //}
+ return pack;
+ }
+ /// <summary>
+ /// 鍒犻櫎鎴块棿
+ /// </summary>
+ /// <param name="roomIds"></param>
+ /// <returns></returns>
+ public ResponsePackNew DeleteRoom(List<string> roomIds)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
+ d.Add("ids", roomIds);
+
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_DelRoom, requestJson);
+ return pack;
}
#endregion
--
Gitblit v1.8.0