From 4f40e8385ff6725be8e8b642e50f9f7201a27dfa Mon Sep 17 00:00:00 2001
From: wei <kaede@kaededeMacBook-Air.local>
Date: 星期五, 11 十二月 2020 15:58:32 +0800
Subject: [PATCH] Merge branch 'NewFilePath' of http://172.16.1.23:6688/r/~wxr/HDL_APP_Project into NewFilePath
---
HDL_ON/DAL/Server/HttpServerRequest.cs | 415 +++++++++++++++++++++++++++++------------------------------
1 files changed, 203 insertions(+), 212 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 41feb45..a69df89 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>
@@ -127,6 +127,18 @@
#endregion
+ /// <summary>
+ /// 缁戝畾璋冭瘯浜哄憳鎻愪氦鐨勪綇瀹�,涓�涓綇瀹呭彧鑳界粦瀹氫竴娆�
+ /// </summary>
+ /// <returns></returns>
+ public ResponsePackNew BindingResidence(string key)
+ {
+ Dictionary<string, object> d = new Dictionary<string, object>();
+ //d.Add("homeId", homeId);
+ d.Add("secretKey", key);
+ var requestJson = HttpUtil.GetSignRequestJson(d);
+ return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_BindlingResidence, requestJson, HttpUtil.GlobalRequestHttpsHost);
+ }
#region 娉ㄥ唽銆佺櫥褰曢儴鍒�
@@ -204,7 +216,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;
@@ -292,32 +304,14 @@
//鏄惁闇�瑕佽幏鍙栧ご鍍�
if (bGetHeadImage)
{
- var headImageBytes = DownHeadImage();
+ var imageKey = ImageUtlis.Current.GetHeadImageKey(info.memberId);
+
+ var headImageBytes = ImageUtlis.Current.DownHeadImage(info.memberId);
+
if (headImageBytes != null && headImageBytes.Length > 0)
{
- UserInfo.Current.headImagePageBytes = headImageBytes;
- FileStream fs = null;
- try
- {
- UserInfo.Current.headImagePageBytes = headImageBytes;
- var filePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/", "headImage.png");
- fs = new FileStream(filePath, FileMode.Create, FileAccess.Write);
- fs.Write(headImageBytes, 0, headImageBytes.Length);
- fs.Flush();
- UserInfo.Current.headImagePagePath = filePath;
- }
- catch (Exception ex)
- {
- MainPage.Log($"download headImage error : {ex.Message}");
- }
- finally
- {
- if (fs != null)
- {
- fs.Close();
- }
- }
-
+ //UserInfo.Current.headImagePageBytes = headImageBytes;
+ UserInfo.Current.headImagePagePath = imageKey;
}
}
@@ -378,11 +372,20 @@
}
/// <summary>
- /// 涓嬭浇鐢ㄦ埛澶村儚
+ /// 鑾峰彇鐢ㄦ埛澶村儚
/// </summary>
- public byte[] DownHeadImage()
+ /// <param name="userId"></param>
+ public void GetUserHeadImage(string userId)
{
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Head_Down, null);
+ 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>
@@ -399,17 +402,17 @@
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UpdateMemberInfo, requestJson);
}
- /// <summary>
- /// 鏇存柊鐢ㄦ埛澶村儚
- /// </summary>
- /// <param name="vs"></param>
- /// <returns></returns>
- public string UpdataUserHeadImage(string fileName)
- {
- byte[] bytes = Shared.IO.FileUtils.ReadFile(fileName);
- var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
- return revertObj.Code;
- }
+ ///// <summary>
+ ///// 鏇存柊鐢ㄦ埛澶村儚
+ ///// </summary>
+ ///// <param name="vs"></param>
+ ///// <returns></returns>
+ //public string UpdataUserHeadImage(string fileName)
+ //{
+ // byte[] bytes = Shared.IO.FileUtils.ReadFile(fileName);
+ // var revertObj = HttpUtil.RequestHttpsUpload(RestSharp.Method.POST, NewAPI.API_POST_Head_Upload, bytes);
+ // return revertObj.Code;
+ //}
/// <summary>
/// 鏇存敼缁戝畾璐︽埛鐨勯偖绠辨垨鑰呮墜鏈哄彿
@@ -460,16 +463,13 @@
var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson);
if (resultObj.Code == StateCode.SUCCESS)
{
+ UserInfo.Current.regionList = new List<RegionInfoRes>();
var homeList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<RegionInfoResNew>>(resultObj.Data.ToString());
if (homeList == null || homeList.Count == 0)
{
-
-
}
else
{
- UserInfo.Current.regionList = new List<RegionInfoRes>();
-
foreach (var mHome in homeList)
{
var home = new RegionInfoRes()
@@ -489,99 +489,36 @@
homeRegionId = mHome.homeRegionId,
Address = mHome.homeAddress,
};
- if (home.IsOthreShare)
- {
- continue;
- }
UserInfo.Current.regionList.Add(home);
}
- if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID))
+ if (string.IsNullOrEmpty(UserInfo.Current.CurReginID))
{
- DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID;
+ UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID;
+ //鎭㈠澶囦唤
+ //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID);
}
+ else
+ {
+ var curRegion = UserInfo.Current.regionList.Find((obj) => obj.RegionID == UserInfo.Current.CurReginID);
+ if(curRegion == null)
+ {
+ UserInfo.Current.CurReginID = UserInfo.Current.regionList[0].RegionID;
+ //鎭㈠澶囦唤
+ //HDLCommon.Current.RestoreHomeBackup(DB_ResidenceData.residenceData.CurReginID);
+ }
+ }
+
+
DB_ResidenceData.residenceData.SaveResidenceData();
UserInfo.Current.SaveUserInfo();
//鍒锋柊涓�娆′綇瀹呯綉鍏�
GetHomeGatewayList();
}
-
}
return resultObj.Code;
-
- //string jsonString = "{" +
- // "\"RequestVersion\":" + "\"" + MainPage.VersionString + "\"" + "," +
- // "\"RequestSource\":" + "\"" + "2" + "\"" + "," +
- // "\"HomeType\":" + "\"" + "1" + "\"" + "," +
- // "\"LoginAccessToken\":" + "\"" + UserInfo.Current.loginTokenString + "\"" +
- // "}";
- //var responsePack = RequestHttps($"{severAddress}/App/GetHomePager", jsonString, false);
-
- //if (responsePack.StateCode.ToUpper() == StateCode.SUCCESS_CODE)
- //{
- // var dataStr = JObject.FromObject(responsePack.ResponseData);
- // //娌℃湁浣忓畢
- // if (dataStr.GetValue("PageData").ToString() == "[]")
- // {
-
- // }
- // else
- // {
- // //{
- // // {
- // // "Id": "1107487",
- // // "HomeStatus": 2,
- // // "UserGuid": "22980",
- // // "Name": "鍟�",
- // // "Address": null,
- // // "Longitude": 0.0,
- // // "Latitude": 0.0,
- // // "RegionName": null,
- // // "Company": null,
- // // "ContactPerson": null,
- // // "ContactPersonPhone": null,
- // // "Remarks": null,
- // // "ChangeDate": null,
- // // "AccountType": 0,
- // // "CreatedOnUtc": "2020-05-27T06:52:03",
- // // "IsOthreShare": false,
- // // "MainUserDistributedMark": null,
- // // "HomeGateways": [
- // // {
- // // "GatewayUniqueId": "4E47323347591243"
- // // }
- // // ]
- // //}}
- // UserInfo.Current.regionList = new List<RegionInfoRes>();
- // foreach (var jsonData in dataStr.GetValue("PageData"))
- // {
- // var homeJsonStr = JObject.FromObject(jsonData);
- // var home = new RegionInfoRes()
- // {
- // RegionID = homeJsonStr.GetValue("Id").ToString(),
- // RegionName = homeJsonStr.GetValue("RegionName").ToString(),
- // Name = homeJsonStr.GetValue("Name").ToString(),
- // Address = homeJsonStr.GetValue("Address").ToString(),
- // IsOthreShare = (bool)homeJsonStr.GetValue("IsOthreShare"),
- // homeGateways = Newtonsoft.Json.JsonConvert.DeserializeObject<List<HomeGateways>>(homeJsonStr.GetValue("HomeGateways").ToString()),
- // };
- // if (home.IsOthreShare)
- // {
- // continue;
- // }
- // UserInfo.Current.regionList.Add(home);
- // if (string.IsNullOrEmpty(DB_ResidenceData.residenceData.CurReginID))
- // {
- // DB_ResidenceData.residenceData.CurReginID = UserInfo.Current.regionList[0].RegionID;
- // }
- // }
- // DB_ResidenceData.residenceData.SaveResidenceData();
- // UserInfo.Current.SaveUserInfo();
- // }
- //}
- //return responsePack.StateCode;
}
/// <summary>
@@ -631,6 +568,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;
}
@@ -889,38 +831,19 @@
}
- /// <summary>
- /// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿淇℃伅
- /// </summary>
- /// <returns></returns>
- public ResponsePack GetResidenceMemberAccountInfo(string account)
- {
- Dictionary<string, object> d = new Dictionary<string, object>();
- d.Add("Account", account);
- string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
- }
+ ///// <summary>
+ ///// 鑾峰彇浣忓畢涓嬬殑鎴愬憳璐﹀彿淇℃伅
+ ///// </summary>
+ ///// <returns></returns>
+ //public ResponsePack GetResidenceMemberAccountInfo(string account)
+ //{
+ // Dictionary<string, object> d = new Dictionary<string, object>();
+ // d.Add("Account", account);
+ // string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+ // return RequestHttps($"{severAddress}/ZigbeeUsers/GetSubAccountInfo", jsonString, true);
+ //}
- /// <summary>
- /// 涓嬭浇瀛愯处鍙风敤鎴峰ご鍍�
- /// </summary>
- /// <param name="subaccoun"></param>
- /// <returns></returns>
- public byte[] DownChildHeadImage(ResidenceMemberInfo subaccount)
- {
- var requestObj = new ChildBaseObj()
- {
- childAccountId = subaccount.childAccountId,
- homeId = subaccount.homeId
- };
- var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(requestObj);
- var replaceToken = "";
- if (DB_ResidenceData.residenceData.residecenInfo.IsOthreShare)
- {
- replaceToken = DB_ResidenceData.residenceData.MasterToken;
- }
- return HttpUtil.RequestHttpsDownload(NewAPI.API_POST_Child_DownloadHeadImage, requestJson,null);
- }
+
#endregion
@@ -971,15 +894,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,
};
@@ -994,8 +917,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;
}
@@ -1018,26 +942,28 @@
/// <summary>
/// 鏌ヨ鎺ㄩ�佷俊鎭垪琛�
/// </summary>
- /// <param name="queryType"></param>
+ /// <param name="queryType">0鍏ㄩ儴 1鍒嗕韩涓庡姛鑳� 2鎶ヨ绫� 3绯荤粺淇℃伅</param>
/// <returns></returns>
public ResponsePackNew PushSerivceGetPushmessagelist(int queryType = 0)
{
- var pushType = "";
+ string pushType = null;
+
if (queryType == 1)
{
pushType = PushType.Default.ToString();
- } else if (queryType == 1)
+ }
+ else if (queryType == 2)
{
pushType = PushType.Alarm.ToString();
}
- else if (queryType == 2)
+ else if (queryType == 3)
{
pushType = PushType.Prompt.ToString();
}
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);
@@ -1049,11 +975,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);
@@ -1074,11 +1000,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);
@@ -1105,13 +1031,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)
@@ -1137,7 +1063,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
{
@@ -1170,7 +1096,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
{
@@ -1809,13 +1735,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>
/// 鑾峰彇璁惧璇︽儏鍒楄〃
@@ -1828,8 +1755,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>
@@ -1838,24 +1779,41 @@
{
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("deviceId", function.deviceId);//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>
/// 璁惧缁戝畾鎴块棿
/// </summary>
- public string BindDeviceToRoom(string deviceId,string roomId)
+ public ResponsePackNew BindDeviceToRoom(List<string> deviceIds,List<string> roomIds)
{
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.residenceData.residecenInfo.RegionID);
- d.Add("deviceIds", new List<string>() { deviceId});
- d.Add("roomIds", new List<string>() { roomId});
+ d.Add("deviceIds", deviceIds);
+ d.Add("roomIds", roomIds);
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_BindDeviceToRoom, requestJson).Code;
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_BindDeviceToRoom, requestJson);
}
/// <summary>
/// 璁惧瑙g粦鎴块棿
@@ -1868,7 +1826,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>
/// 璁惧鍚嶇О淇敼
@@ -1881,31 +1839,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
@@ -1927,7 +1885,7 @@
}
var requestJson = HttpUtil.GetSignRequestJson(d);
- return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_GetSecneList, requestJson);
+ return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetSecneList, requestJson);
}
/// <summary>
/// 鑾峰彇鍦烘櫙璇︽儏
@@ -1940,7 +1898,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>
/// 娣诲姞鍦烘櫙
@@ -1949,10 +1907,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>
/// 缂栬緫鍦烘櫙
@@ -1966,7 +1925,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>
/// 鍒犻櫎鍦烘櫙
@@ -1979,7 +1938,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>
/// 鎵ц鍦烘櫙
@@ -1992,7 +1951,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>
/// 鏀惰棌鍦烘櫙
@@ -2006,7 +1965,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>
/// 鍙栨秷鏀惰棌鍦烘櫙
@@ -2020,7 +1979,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
@@ -2028,42 +1987,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