From 33656fa9abd15ed00a390024b439568d2713ca1a Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期日, 06 十二月 2020 17:44:36 +0800
Subject: [PATCH] 2020-12-06 1.修改挤下线判断标记。2.修改房间和场景加载云端图片路径
---
HDL_ON/DAL/Server/HttpServerRequest.cs | 151 ++++++++++++++++++++++++++++++++++----------------
1 files changed, 103 insertions(+), 48 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index f156f7b..09c3ea8 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -359,7 +359,22 @@
}
-
+ /// <summary>
+ /// 鑾峰彇鐢ㄦ埛澶村儚
+ /// </summary>
+ /// <param name="userId"></param>
+ public void GetUserHeadImage(string userId)
+ {
+ var imageKey = ImageUtlis.Current.GetHeadImageKey(userId);
+
+ var headImageBytes = ImageUtlis.Current.DownHeadImage(userId);
+
+ if (headImageBytes != null && headImageBytes.Length > 0)
+ {
+ //UserInfo.Current.headImagePageBytes = headImageBytes;
+ UserInfo.Current.headImagePagePath = imageKey;
+ }
+ }
/// <summary>
/// 鏇存柊鐢ㄦ埛鏄电О
@@ -621,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;
}
@@ -942,15 +962,15 @@
isProduce = false;
#endif
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken)) {
+ if (string.IsNullOrEmpty(UserInfo.Current.PushDeviceToken)) {
Utlis.WriteLine("PushDeviceToken 涓虹┖");
return false;
}
var mAddpushinfoObj = new AddpushinfoObj()
{
- pushToken = OnAppConfig.Instance.PushDeviceToken,
- deviceName = OnAppConfig.Instance.PhoneName,
+ pushToken = UserInfo.Current.PushDeviceToken,
+ deviceName = UserInfo.Current.PhoneName,
deviceType = deviceType,
produce = isProduce,
};
@@ -965,8 +985,9 @@
var pushId = revertObj.Data.ToString();
if (!string.IsNullOrEmpty(pushId))
{
- OnAppConfig.Instance.PushId = pushId;
- OnAppConfig.Instance.SaveUserConfig();
+ UserInfo.Current.PushId = pushId;
+ UserInfo.Current.SaveUserInfo();
+ Utlis.WriteLine("PushId: " + pushId);
return true;
}
@@ -1010,7 +1031,7 @@
var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj()
{
- pushId = OnAppConfig.Instance.PushId,
+ pushId = UserInfo.Current.PushId,
pushType = pushType
});
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist, requestJson);
@@ -1022,11 +1043,11 @@
/// <returns></returns>
public bool PushSerivceClearmessagelist()
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
{
- pushId = OnAppConfig.Instance.PushId
+ pushId = UserInfo.Current.PushId
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Clearmessagelist, requestJson);
@@ -1047,11 +1068,11 @@
/// <returns></returns>
public bool PushSerivceSignOut()
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj() {
- pushId = OnAppConfig.Instance.PushId
+ pushId = UserInfo.Current.PushId
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_DeleteToken, requestJson);
@@ -1078,13 +1099,13 @@
/// <returns></returns>
public bool PushSerivceMarkAllMessageRead()
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
var requestJson = HttpUtil.GetSignRequestJson(new PushIdObj()
{
- pushId = OnAppConfig.Instance.PushId
+ pushId = UserInfo.Current.PushId
});
var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_ALLMarkread, requestJson);
if (revertObj.Code == StateCode.SUCCESS)
@@ -1110,7 +1131,7 @@
/// <returns></returns>
public bool PushSerivceMarkMessageRead(string msgId)
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
@@ -1143,7 +1164,7 @@
/// <returns></returns>
public bool PushSerivceDeleteMessage(string msgId)
{
- if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
+ if (string.IsNullOrEmpty(UserInfo.Current.PushId)) return false;
try
{
@@ -1782,13 +1803,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>
/// 鑾峰彇璁惧璇︽儏鍒楄〃
@@ -1801,7 +1823,7 @@
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>
/// 鎺у埗璁惧
@@ -1811,11 +1833,11 @@
{
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>
/// 璁惧缁戝畾鎴块棿
@@ -1828,7 +1850,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粦鎴块棿
@@ -1841,7 +1863,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>
/// 璁惧鍚嶇О淇敼
@@ -1854,7 +1876,7 @@
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>
/// 鏀惰棌璁惧
@@ -1866,7 +1888,7 @@
d.Add("deviceId",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).Code;
}
/// <summary>
/// 鍙栨秷鏀惰棌璁惧
@@ -1878,7 +1900,7 @@
d.Add("deviceId", 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).Code;
}
#endregion
@@ -1900,7 +1922,7 @@
}
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetSecneList, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
}
/// <summary>
/// 鑾峰彇鍦烘櫙璇︽儏
@@ -1913,7 +1935,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>
/// 娣诲姞鍦烘櫙
@@ -1922,10 +1944,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>
/// 缂栬緫鍦烘櫙
@@ -1939,7 +1962,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>
/// 鍒犻櫎鍦烘櫙
@@ -1952,7 +1975,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>
/// 鎵ц鍦烘櫙
@@ -1965,7 +1988,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>
/// 鏀惰棌鍦烘櫙
@@ -1979,7 +2002,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>
/// 鍙栨秷鏀惰棌鍦烘櫙
@@ -1993,7 +2016,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
@@ -2001,42 +2024,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