From dc9a1b15bb69227e19afc070adf58156a362d2a2 Mon Sep 17 00:00:00 2001
From: wxr <wxr@hdlchina.com.cn>
Date: 星期一, 30 九月 2024 17:07:58 +0800
Subject: [PATCH] 安卓可视对讲响铃,

---
 HDL_ON/DAL/Server/HttpServerRequest.cs |   57 +++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 25c2273..10cec37 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -22,13 +22,10 @@
             var sss = Newtonsoft.Json.Linq.JObject.FromObject("sss");
             var xxx = homeJsonStr.GetValue("xxx").ToString(),
 
-            
-                    Dictionary<string, object> d = new Dictionary<string, object>();
-                    d.Add("Id", fId);
-                    var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
-
-
-              */
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("Id", fId);
+            var jsonString = Newtonsoft.Json.JsonConvert.SerializeObject(d);
+         */
 
 
         string severAddress = "https://global.hdlcontrol.com/ProposedProductionApi";
@@ -41,7 +38,7 @@
         /// <summary>
         /// 鑾峰彇浼犳劅鍣ㄥ巻鍙叉暟鎹�
         /// </summary>
-        /// <param name="qType">鏃堕棿鏌ヨ绫诲瀷锛歨our=杩�24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈� </param>
+        /// <param name="qType">鏃堕棿鏌ヨ绫诲瀷锛歨our=杩�24灏忔椂銆乨ay_hour =鏌愭棩24灏忔椂銆亀eek=杩戜竴鍛ㄣ�乵onth = 杩戜竴鏈堛�乧ustom_month=鏌愬勾鏌愭湀 y/M銆乧ustom_year=鏌愬勾 y</param>
         /// <param name="deviceId">璁惧ID</param>
         /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param>
         /// <param name="time">鍏蜂綋鏌ヨ鐨勬棩鏈燂紝閲戣寕娓╂帶鍣ㄤ娇鐢�</param>
@@ -161,7 +158,7 @@
         /// 鍒锋柊Token
         /// </summary>
         /// <returns></returns>
-        public string RefreshToken()
+        public string RefreshToken(bool canRefresh = true)
         {
             var requestJson = HttpUtil.GetSignRequestJson(new RefreshTokenObj()
             {
@@ -174,7 +171,7 @@
                 UserInfo.Current.LoginTokenString = revertData.headerPrefix + revertData.accessToken;
                 UserInfo.Current.AccessToken = revertData.accessToken;
                 UserInfo.Current.RefreshToken = revertData.refreshToken;
-                UserInfo.Current.LastTime = DateTime.Now;
+                UserInfo.Current.ValidToken = true;
                 UserInfo.Current.SaveUserInfo();
 
 #if __IOS__
@@ -185,8 +182,18 @@
             }
             else if (revertObj.Code == StateCode.PasswrodError)
             {
-                UserInfo.Current.LastTime = DateTime.MinValue;
+                UserInfo.Current.ValidToken = false;
             }
+#if __IOS__
+            else if (revertObj.Code == "10001")
+            {
+                if (canRefresh)
+                {
+                    UserInfo.Current.RefreshToken = SiriKit.NSUserDefaultsHelper.DataSuite.StringForKey(SiriKit.NSUserDefaultsHelper.StorageKeys.GLOBAL_GRefreshToken);
+                    RefreshToken(false);
+                }
+            }
+#endif
             return revertObj.Code;
         }
 
@@ -698,8 +705,8 @@
                         {
                             if (mHomeGatewayRes.Count > 0)
                             {
-                                DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];
-                                DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus;
+                                DB_ResidenceData.Instance.HomeGateway = mHomeGatewayRes[0];//缃戝叧鐘舵��
+                                HDL_ON.DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes[0].gatewayStatus;
                                 DB_ResidenceData.Instance.SaveResidenceData();
                                 return revertObj.Code;
                             }
@@ -765,7 +772,7 @@
                 var mHomeGatewayRes = Newtonsoft.Json.JsonConvert.DeserializeObject<HomeGatewayInfo>(revertObj.Data.ToString());
                 if (mHomeGatewayRes != null)
                 {
-                    DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus;
+                    HDL_ON.DriverLayer.Control.Ins.GatewayOnline_Cloud = mHomeGatewayRes.gatewayStatus;
                 }
             }
             return revertObj.Code;
@@ -1191,7 +1198,6 @@
                     deviceName = OnAppConfig.Instance.PhoneName,
                     deviceType = deviceType,
                     produce = isProduce,
-
                 };
                 mAddpushinfoObj.languageType = Utlis.GetPostLanguageType();
 
@@ -1218,7 +1224,6 @@
                             return true;
                         }
                     }
-
                 }
                 else
                 {
@@ -1527,7 +1532,7 @@
         }
 #endregion
 
-#region 鑾峰彇澶╂皵閮ㄥ垎
+        #region 鑾峰彇澶╂皵閮ㄥ垎
         /// <summary>
         /// 鑾峰彇鎸囧畾缁忕含搴︾殑鍩庡競淇℃伅澶╂皵淇℃伅
         /// </summary>
@@ -2308,6 +2313,23 @@
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
         }
+
+        /// <summary>
+        /// 缂栬緫璁惧淇℃伅
+        /// 缁戝畾鍏崇郴銆佸悕绉般�佹敹钘�
+        /// </summary>
+        /// <returns></returns>
+        public ResponsePackNew UpdataDevcieName(string deviceId,string name)
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("name", name);
+
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_EditDevice, requestJson);
+        }
+
         /// <summary>
         /// 缂栬緫璁惧淇℃伅
         /// 缁戝畾鍏崇郴銆佸悕绉般�佹敹钘�
@@ -3649,7 +3671,6 @@
             var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetGroupControlInfos, requestJson);
             return pack;
         }
-
         /// <summary>
         /// 鑾峰彇缇ゆ帶璇︽儏
         /// </summary>

--
Gitblit v1.8.0