From 80b9bef2485d35dc9eb7ab6424b26602e5198d3d Mon Sep 17 00:00:00 2001
From: hxb <hxb@hdlchina.com.cn>
Date: 星期四, 29 七月 2021 09:46:51 +0800
Subject: [PATCH] 萤石测试通过
---
HDL_ON/DAL/Server/HttpServerRequest.cs | 162 +++++++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 137 insertions(+), 25 deletions(-)
diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 2e45be6..ceee580 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -464,13 +464,25 @@
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_UnbindWithAccount, requestJson).Code;
}
+ /// <summary>
+ /// 鏍规嵁璐﹀彿,鑾峰彇璐﹀彿淇℃伅
+ /// </summary>
+ /// <param name="i_account">鎸囧畾璐﹀彿</param>
+ /// <returns></returns>
+ public ResponsePackNew GetMemberInfoByAccount(string i_account)
+ {
+ var pra = new { account = i_account };
+ var requestJson = HttpUtil.GetSignRequestJson(pra);
+ return HttpUtil.RequestHttpsPost(NewAPI.API_POST_Member_GetMemberInfoByAccount, requestJson);
+ }
+
#endregion
#region 浣忓畢閮ㄥ垎
/// <summary>
/// 鑾峰彇浣忓畢鍒楄〃
/// </summary>
- public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL)
+ public string GetHomePager(HomeTypeEnum homeType = HomeTypeEnum.ALL,string homeId = "")
{
var requestJson = HttpUtil.GetSignRequestJson(new GetHomeListObj() { homeType = homeType.ToString() });
var resultObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_Gethomepager, requestJson);
@@ -485,28 +497,17 @@
{
foreach (var home in homeList)
{
- //var home = new RegionInfoRes()
- //{
- // RegionID = mHome.Id,
- // Name = mHome.homeName,
- // IsOthreShare = mHome.IsOtherShare,
- // accountType = mHome.accountType,
- // isRemoteControl = mHome.isRemoteControl,
- // isBindGateway = mHome.isBindGateway,
- // longitude = mHome.longitude,
- // latitude = mHome.latitude,
- // deliverstatus = mHome.deliverstatus,
- // homeType = mHome.homeType,
- // regionUrl = mHome.regionUrl,
- // emqUrl = mHome.emqUrl,
- // homeRegionName = mHome.homeRegionName,
- // homeRegionId = mHome.homeRegionId,
- // Address = mHome.homeAddress,
- // isAllowCreateScene = mHome.isAllowCreateScene,
- //};
if (home.isBindGateway)
{
UserInfo.Current.regionList.Add(home);
+ //鏂扮粦瀹氱殑浣忓畢锛岀洿鎺ュ垏鎹㈠埌鏂颁綇瀹�
+ if (!string.IsNullOrEmpty(homeId))
+ {
+ if (homeId.Contains(home.id))
+ {
+ DB_ResidenceData.Instance.CurrentRegion = home;
+ }
+ }
}
}
if(UserInfo.Current.regionList.Count== 0)
@@ -708,6 +709,42 @@
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Child_Update, requestJson);
}
+ /// <summary>
+ /// 杩囨埛
+ /// </summary>
+ /// <param name="i_account">瀵规柟璐﹀彿</param>
+ /// <returns></returns>
+ public bool TransferResidence(string i_account)
+ {
+ var pra2 = new
+ {
+ homeId = Entity.DB_ResidenceData.Instance.CurrentRegion.id,
+ account = i_account
+ };
+ var requestJson = HttpUtil.GetSignRequestJson(pra2);
+ var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_TransferResidence, requestJson);
+
+ return result != null && result.Code == StateCode.SUCCESS;
+ }
+
+ /// <summary>
+ /// 绠$悊鍛樻潈闄愯縼绉�
+ /// </summary>
+ /// <param name="i_childAccountId">鎴愬憳璐﹀彿id</param>
+ /// <returns></returns>
+ public bool AdminAuthorityMigration(string i_childAccountId)
+ {
+ var pra2 = new
+ {
+ homeId = DB_ResidenceData.Instance.CurrentRegion.id,
+ childAccountId = i_childAccountId
+ };
+ var requestJson = HttpUtil.GetSignRequestJson(pra2);
+ var result = HttpUtil.RequestHttpsPost(NewAPI.API_Post_AdminAuthorityMigration, requestJson);
+
+ return result != null && result.Code == StateCode.SUCCESS;
+ }
+
#region 鏂版暟鎹垎浜�
/// <summary>
/// 娣诲姞鍒嗕韩
@@ -897,8 +934,9 @@
Dictionary<string, object> d = new Dictionary<string, object>();
d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
d.Add("debugPerm", debugPerm);
- string jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
- return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString);
+ var jsonString = HttpUtil.GetSignRequestJson(d,d);
+ var pack = HttpUtil.RequestHttpsPost(NewAPI.API_Post_Home_UpdateDebugPerm, jsonString);
+ return pack;
}
@@ -1025,7 +1063,8 @@
var requestJson = HttpUtil.GetSignRequestJson(new GetMessageListObj()
{
pushId = OnAppConfig.Instance.PushId,
- pushType = pushType
+ pushType = pushType,
+ homeId = DB_ResidenceData.Instance.CurrentRegion.id,
});
return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist, requestJson);
}
@@ -1920,7 +1959,7 @@
d.Add("actions", actionObjs);
var requestJson = HttpUtil.GetSignRequestJson(d);
- MainPage.Log($"{requestJson}");
+ MainPage.Log($"api鍔熻兘鎺у埗锛歿requestJson}");
return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_ControlDevice, requestJson);
}
/// <summary>
@@ -2430,10 +2469,13 @@
#region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________
/// <summary>
/// 娌充笢鑾峰彇钀ょ煶浜戝瓙璐﹀彿token鐨勬帴鍙�
+ /// 2021-07-07 鏂版柟妗堟帴鍙h皟鏁村鎺�
/// </summary>
public ResponsePackNew EZGetChildToken()
{
Dictionary<string, object> d = new Dictionary<string, object>();
+ d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ d.Add("platform", "1");
var requestJson = HttpUtil.GetSignRequestJson(d);
return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_EZ_GetChildToken, requestJson);
}
@@ -2442,7 +2484,7 @@
#region 鈻� 鍙瀵硅_________________________
/// <summary>
- /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋楋紝骞惰幏鍙栭棬鍙f満鍒楄〃
+ /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋�
/// </summary>
/// <returns></returns>
public ResponsePackNew CheckFlVideo()
@@ -2455,6 +2497,76 @@
}
#endregion
+ #region 鈻� 闂ㄩ攣鐩稿叧____________________________
+
+ /// <summary>
+ /// 鑾峰彇闂ㄩ攣鍘嗗彶璁板綍(鎸夋棩鏈熼檷搴�)
+ /// </summary>
+ /// <param name="i_device">璁惧瀵硅薄</param>
+ /// <returns></returns>
+ public List<Stan.DoorHistoryLog> GetDoorHistoryLogs(Function i_device)
+ {
+ //var dicPra = new Dictionary<string, object>();
+ //dicPra.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+ //dicPra.Add("deviceId", i_device.deviceId);
+ //dicPra.Add("logType", "OPEN_DOOR");
+ //dicPra.Add("pageSize", "200");
+ //var requestJson = HttpUtil.GetSignRequestJson(dicPra);
+ //var packData = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_DoorHistory, requestJson);
+ //if (packData.Code != StateCode.SUCCESS)
+ //{
+ // return null;
+ //}
+
+
+ //娴嬭瘯
+ var listLog = new List<Stan.DoorHistoryLog>();
+ for (int i = 1; i <= 3; i++)
+ {
+ var logInfo = new Stan.DoorHistoryLog { StrMsg = "鐢甸噺浣庯紝璇锋洿鎹㈢數姹�" };
+ logInfo.Time = new DateTime(2000, 5, 6, 10, 45, 23).AddDays(i);
+ listLog.Add(logInfo);
+ }
+ for (int i = 1; i <= 3; i++)
+ {
+ var logInfo = new Stan.DoorHistoryLog { StrMsg = "鐢甸噺浣庯紝璇锋洿鎹㈢數姹�" };
+ logInfo.Time = new DateTime(2001, 5, 6, 10, 45, 23).AddDays(i);
+ listLog.Add(logInfo);
+ }
+ for (int i = 1; i <= 3; i++)
+ {
+ var logInfo = new Stan.DoorHistoryLog { StrMsg = "鐢甸噺浣庯紝璇锋洿鎹㈢數姹�" };
+ logInfo.Time = new DateTime(2002, 5, 6, 10, 45, 23).AddDays(i);
+ listLog.Add(logInfo);
+ }
+
+ //鎸夋椂闂撮檷搴�
+ var listSortLog = new List<Stan.DoorHistoryLog>();
+ foreach (var logInfo in listLog)
+ {
+ bool canAdd = true;
+ for (int i = 0; i < listSortLog.Count; i++)
+ {
+ if (logInfo.Time > listSortLog[i].Time)
+ {
+ //鏃堕棿姣斿綋鍓嶇殑绱㈠紩澶�,鍒欐彃鍏ュ埌瀹冪殑鍓嶉潰
+ listSortLog.Insert(i, logInfo);
+ canAdd = false;
+ break;
+ }
+ }
+ if (canAdd == true)
+ {
+ //鏃ユ湡鏈�灏�,鍒欐坊鍔犲埌鏈熬
+ listSortLog.Add(logInfo);
+ }
+ }
+ //鎻愮ず
+ //IMessageCommon.Current.ShowErrorInfoAlter(responePack.Code);
+ return listSortLog;
+ }
+
+ #endregion
#region 鈻� 闊崇璇█鎺у埗鐩稿叧_________________________
/// <summary>
/// 鑾峰彇宸叉巿鏉冪殑闊崇鍒楄〃
--
Gitblit v1.8.0