From efad979b6fae76fb37a4de7e94e6bac0a85cb72c Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期二, 30 十一月 2021 13:14:28 +0800
Subject: [PATCH] 2021-11-30 1.修复乐橙Android,没调用拒接接口问题。

---
 HDL_ON/DAL/Server/HttpServerRequest.cs |  289 +++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 226 insertions(+), 63 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 8218c94..aec2776 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -51,7 +51,7 @@
             d.Add("type", qType);
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
             d.Add("deviceId",  deviceId );
-            d.Add("key",  "value" );
+            d.Add("key",  deviceKey );
 
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
@@ -74,8 +74,20 @@
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_ArmSensorHistoricalData, requestJson);
         }
+        /// <summary>
+        /// 璇诲彇鏈�杩戜竴涓湀鐨勬暟鎹�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetLastMonthHistory(string deviceId,string key)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("key", key);
 
-
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_SensorLastMonthHistoricalData, requestJson);
+        }
 
 
         #endregion
@@ -452,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);
@@ -473,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)
@@ -696,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>
         /// 娣诲姞鍒嗕韩
@@ -885,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;
         }
 
 
@@ -954,7 +1004,15 @@
                     deviceName = OnAppConfig.Instance.PhoneName,
                     deviceType = deviceType,
                     produce = isProduce,
+                    
                 };
+                mAddpushinfoObj.languageType = Utlis.GetPostLanguageType();
+
+#if DEBUG
+                //List<string> communityCodes = new List<string>();
+                //communityCodes.Add("");
+                //mAddpushinfoObj.communityCodes = communityCodes;
+#endif
 
                 //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj);
                 var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj);
@@ -991,7 +1049,7 @@
         /// <summary>
         /// 鏌ヨ鎺ㄩ�佷俊鎭垪琛�
         /// </summary>
-        /// <param name="queryType">0鍏ㄩ儴 1鍒嗕韩涓庡姛鑳� 2鎶ヨ绫� 3绯荤粺淇℃伅</param>
+        /// <param name="queryType">0鍏ㄩ儴 1鍒嗕韩涓庡姛鑳� 2鎶ヨ绫� 3绯荤粺淇℃伅 4鐗╀笟閫氱煡</param>
         /// <returns></returns>
         public ResponsePackNew PushSerivceGetPushmessagelist(int queryType = 0)
         {
@@ -1009,13 +1067,18 @@
             {
                 pushType = PushType.Prompt.ToString();
             }
-
+            else if (queryType == 4)
+            {
+                pushType = PushType.Notice.ToString();
+            }
             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);
+            //2021-08-28 鏀逛负鍒嗛〉鏌ヨ
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Getpushmessagelist_Paging, requestJson);
         }
 
         /// <summary>
@@ -1143,16 +1206,13 @@
         /// </summary>
         /// <param name="msgId"></param>
         /// <returns></returns>
-        public bool PushSerivceDeleteMessage(string msgId)
+        public bool PushSerivceDeleteMessage(PushMsgIdObj mPushMsgIdObj)
         {
             if (string.IsNullOrEmpty(OnAppConfig.Instance.PushId)) return false;
-
+            if (mPushMsgIdObj == null) return false;
             try
             {
-                var requestJson = HttpUtil.GetSignRequestJson(new PushMsgIdObj()
-                {
-                    msgId = msgId
-                });
+                var requestJson = HttpUtil.GetSignRequestJson(mPushMsgIdObj);
 
                 var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_Deletepushinfo, requestJson);
                 if (revertObj.Code == StateCode.SUCCESS)
@@ -1211,6 +1271,18 @@
             { IsBackground = true }.Start();
         }
 
+        /// <summary>
+        /// 鑾峰彇鐗╀笟鍏憡璇︽儏
+        /// </summary>
+        /// <param name="noticeId"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetPropertyNoticeDetails(string noticeId)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("noticeId", noticeId);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_GetNoticeInfo, requestJson);
+        }
         #endregion
 
         #region 妫�娴嬫洿鏂�
@@ -1231,9 +1303,9 @@
 
 
 
-        #endregion
+#endregion
 
-        #region 鑾峰彇澶╂皵閮ㄥ垎
+#region 鑾峰彇澶╂皵閮ㄥ垎
         /// <summary>
         /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅
         /// </summary>
@@ -1278,6 +1350,9 @@
                             MainPage.cityInfo.pm25 = jt.GetValue("Air_Quality").ToString();
                             MainPage.cityInfo.windLevel = jt.GetValue("WindLevel").ToString();
                             MainPage.cityInfo.weather = jt.GetValue("Weather").ToString();
+                            MainPage.cityInfo.lowestTemperature = jt.GetValue("lowestTemperature").ToString();
+                            MainPage.cityInfo.highestTemperature = jt.GetValue("highestTemperature").ToString();
+
                             break;
                         }
                         catch (Exception ex)
@@ -1298,10 +1373,10 @@
             });
         }
 
-        #endregion
+#endregion
 
 
-        #region 澶囦唤閮ㄥ垎
+#region 澶囦唤閮ㄥ垎
         ///// <summary>
         ///// 鑾峰彇浣忓畢澶囦唤鍒楄〃
         ///// </summary>
@@ -1347,11 +1422,11 @@
                 var requestJson = Newtonsoft.Json.JsonConvert.SerializeObject(d);
                 var revertObj = RequestHttps("https://developer.hdlcontrol.com/api/UserBackupList", requestJson, true);
                 var jt = Newtonsoft.Json.JsonConvert.DeserializeObject<List<JObject>>(revertObj.ResponseData.ToString());
-                #region 鎭㈠鎴块棿鏁版嵁
+#region 鎭㈠鎴块棿鏁版嵁
 
 
                 GetBackupRoom(jt,loading);
-                #endregion
+#endregion
                
                 Application.RunOnMainThread(() => {
                     loading.Hide();
@@ -1772,10 +1847,10 @@
         }
         */
 
-        #endregion
+#endregion
 
 
-        #region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��
+#region Kaede --璁惧鍔熻兘鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��
         /// <summary>
         /// 鑾峰彇璁惧鍒楄〃
         /// </summary>
@@ -1805,7 +1880,10 @@
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
             d.Add("productPlatform", productPlatform);
             d.Add("productBrand", productBrand);
-            d.Add("networkConfig", true);
+            if (productBrand != "MegaHealth")
+            {
+                d.Add("networkConfig", true);
+            }
 
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
@@ -1824,10 +1902,31 @@
             d.Add("productBrand", productBrand);
             d.Add("networkConfig", true);
             
-
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Get3tyBrandDevcieList, requestJson);
         }
+        /// <summary>
+        /// 娉ㄥ唽绗笁鏂硅澶�
+        /// </summary>
+        /// <param name="productPlatform"></param>
+        /// <param name="productBrand"></param>
+        /// <returns></returns>
+        public ResponsePackNew IndependentRegister3TyDevcie(string spk,string extDevId,string deviceName,string pairCode = "")
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("spk", spk);
+            d.Add("extDevId", extDevId);
+            d.Add("name", deviceName);
+            d.Add("code", pairCode);
+
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_IndependentRegister3TyDevcie, requestJson);
+        }
+
+
+
 
         /// <summary>
         /// 鑾峰彇璁惧璇︽儏
@@ -1883,7 +1982,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>
@@ -1983,9 +2082,9 @@
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectDevice, requestJson);
         }
 
-        #endregion
+#endregion
 
-        #region Kaede --鍦烘櫙鍔熻兘--------------------------
+#region Kaede --鍦烘櫙鍔熻兘--------------------------
         /// <summary>
         /// 鑾峰彇鍦烘櫙鍒楄〃
         /// 鎴块棿ID鍙┖锛岄粯璁ゆ煡璇綇瀹呬笅鎵�鏈夋埧闂�
@@ -2117,9 +2216,9 @@
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_CancelCollectScene, requestJson).Code;
         }
-        #endregion
+#endregion
 
-        #region Kaede --鎴块棿鍔熻兘--------------------------
+#region Kaede --鎴块棿鍔熻兘--------------------------
         /// <summary>
         /// 鑾峰彇鎴块棿鍒楄〃
         /// </summary>
@@ -2194,10 +2293,10 @@
             return pack;
         }
 
-        #endregion
+#endregion
 
 
-        #region Kaede -- 瀹夐槻鎺ュ彛____________________________
+#region Kaede -- 瀹夐槻鎺ュ彛____________________________
         /// <summary>
         /// 鑾峰彇瀹夐槻鍒楄〃
         /// </summary>
@@ -2299,6 +2398,7 @@
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
             d.Add("securitys", securityStates);
             var requestJson = HttpUtil.GetSignRequestJson(d);
+            MainPage.Log($"api瀹夐槻鎺у埗锛歿requestJson}");
             var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_Security_StatusSet, requestJson);
             return pack;
         }
@@ -2360,10 +2460,10 @@
             return pack;
         }
 
-        #endregion
+#endregion
 
 
-        #region Kaede --绗笁鏂瑰搧鐗屽姛鑳�--------------------------
+#region Kaede --绗笁鏂瑰搧鐗屽姛鑳�--------------------------
         /// <summary>
         /// 鑾峰彇绗笁鏂瑰搧鐗屽垪琛�
         /// </summary>
@@ -2388,24 +2488,27 @@
             return pack;
         }
 
-        #endregion
+#endregion
 
-        #region 鈻� 钀ょ煶浜慡DK鐩稿叧鎺ュ彛_________________________
+#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);
         }
-        #endregion
+#endregion
 
 
-        #region 鈻� 鍙瀵硅_________________________
+#region 鈻� 鍙瀵硅_________________________
         /// <summary>
-        /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋楋紝骞惰幏鍙栭棬鍙f満鍒楄〃
+        /// 妫�鏌ヤ綇瀹呮槸鍚︾粦瀹氫赴鏋�
         /// </summary>
         /// <returns></returns>
         public ResponsePackNew CheckFlVideo()
@@ -2416,9 +2519,9 @@
             var pack = HttpUtil.RequestHttpsPostFroHome( NewAPI.API_POST_FL_Check, requestJson);
             return pack;
         }
-        #endregion
+#endregion
 
-        #region 鈻� 闂ㄩ攣鍘嗗彶璁板綍________________________
+#region 鈻� 闂ㄩ攣鐩稿叧____________________________
 
         /// <summary>
         /// 鑾峰彇闂ㄩ攣鍘嗗彶璁板綍(鎸夋棩鏈熼檷搴�)
@@ -2427,6 +2530,19 @@
         /// <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++)
@@ -2474,8 +2590,8 @@
             return listSortLog;
         }
 
-        #endregion
-        #region 鈻� 闊崇璇█鎺у埗鐩稿叧_________________________
+#endregion
+#region 鈻� 闊崇璇█鎺у埗鐩稿叧_________________________
         /// <summary>
         /// 鑾峰彇宸叉巿鏉冪殑闊崇鍒楄〃
         /// </summary>
@@ -2539,7 +2655,54 @@
             var requestJson = HttpUtil.GetSignRequestJson(updateSpeakerDeviceListObj);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_Speaker_DeviceList_Update, requestJson);
         }
-        #endregion
+#endregion
 
+
+        /// <summary>
+        /// 浜鸿劯褰曞叆
+        /// </summary>
+        /// <param name="imageBytes"></param>
+        /// <returns></returns>
+        public ResponsePackNew FaceSetting(string imageBytes)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("userFace", @"data:image/jpg;base64,"+imageBytes);
+            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
+
+            //MainPage.Log(imageBytes);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_InputUserFace, requestJson);
+        }
+
+
+        /// <summary>
+        /// 淇敼浣忔埛浜鸿劯鍏抽棴鐘舵��
+        /// 1锛氬紑鍚姸鎬� 2锛氬叧闂姸鎬�
+        /// 3:娓呴櫎浜鸿劯鏁版嵁
+        /// </summary>
+        public ResponsePackNew EditFaceFunction(int status)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("faceClose", status);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_SwitchFaceFunction, requestJson);
+        }
+
+
+        /// <summary>
+        /// 鑾峰彇浣忔埛璇︽儏
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew GetCustomerInfo()
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("houseId", DB_ResidenceData.Instance.CurrentRegion.id);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetCustomerInfo, requestJson);
+        }
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0