From 4c586bb23cdcae56ae4e4c62e90e148dc10b9d90 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期二, 17 五月 2022 14:19:31 +0800
Subject: [PATCH] Merge branch 'Dev-Branch' into wxr1215

---
 HDL_ON/DAL/Server/HttpServerRequest.cs |   55 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 45 insertions(+), 10 deletions(-)

diff --git a/HDL_ON/DAL/Server/HttpServerRequest.cs b/HDL_ON/DAL/Server/HttpServerRequest.cs
index 2414895..4e3ed71 100644
--- a/HDL_ON/DAL/Server/HttpServerRequest.cs
+++ b/HDL_ON/DAL/Server/HttpServerRequest.cs
@@ -5,6 +5,7 @@
 using System.Text;
 using HDL_ON.Entity;
 using Newtonsoft.Json.Linq;
+using Shared;
 
 namespace HDL_ON.DAL.Server
 {
@@ -45,13 +46,17 @@
         /// <param name="deviceId">璁惧ID</param>
         /// <param name="deviceKey">鍔熻兘鏌ヨ绫诲瀷锛歱m25</param>
         /// <returns></returns>
-        public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey)
+        public ResponsePackNew GetSensorHistory(string qType, string deviceId, string deviceKey,string time = "")
         {
             Dictionary<string, object> d = new Dictionary<string, object>();
             d.Add("type", qType);
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
             d.Add("deviceId", deviceId);
             d.Add("key", deviceKey);
+            if(time!= "")
+            {
+                d.Add("time", time);
+            }
 
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPost(NewAPI.Api_Post_EnvironmentalSensorHistoricalData, requestJson);
@@ -152,6 +157,10 @@
                 sdm.AccessToken = UserInfo.Current.LoginTokenString;
                 sdm.RefreshToken = UserInfo.Current.RefreshToken;
 #endif
+            }
+            else if (revertObj.Code == StateCode.PasswrodError)
+            {
+                UserInfo.Current.LastTime = DateTime.MinValue;
             }
             return revertObj.Code;
         }
@@ -1025,10 +1034,10 @@
 #endif
                 //鏄惁鐢熶骇妯″紡
                 bool isProduce = true;
-#if DEBUG
-                isProduce = false;
-#endif
-
+                if (HttpUtil.GlobalRequestHttpsHost == "https://test-gz.hdlcontrol.com")
+                {
+                    isProduce = false;
+                }
                 if (string.IsNullOrEmpty(OnAppConfig.Instance.PushDeviceToken))
                 {
                     Utlis.WriteLine("PushDeviceToken 涓虹┖");
@@ -1053,9 +1062,15 @@
 
                 //var mAddpushinfoJson = Newtonsoft.Json.JsonConvert.SerializeObject(mAddpushinfoObj);
                 var mAddpushinfoJson = HttpUtil.GetSignRequestJson(mAddpushinfoObj);
+
+                Utlis.WriteLine("mAddpushinfoJson: " + mAddpushinfoJson);
+
+                //new Alert("", , "鍙栨秷", "纭畾").Show();
                 var revertObj = HttpUtil.RequestHttpsPost(NewAPI.API_POST_PushSerivce_AddToken, mAddpushinfoJson);
                 if (revertObj.Code == StateCode.SUCCESS)
                 {
+                    //new Alert("", "鎻愪氦pushToken鎴愬姛" + OnAppConfig.Instance.PushDeviceToken, "鍙栨秷", "纭畾").Show();
+
                     if (revertObj.Data != null)
                     {
                         var pushId = revertObj.Data.ToString();
@@ -1064,7 +1079,7 @@
                             OnAppConfig.Instance.PushId = pushId;
                             OnAppConfig.Instance.SaveConfig();
                             Utlis.WriteLine("PushId: " + pushId);
-
+                            //new Alert("","鎻愪氦pushToken鎴愬姛"+ OnAppConfig.Instance.PushDeviceToken, "鍙栨秷","纭畾").Show();
                             return true;
                         }
                     }
@@ -1072,7 +1087,7 @@
                 }
                 else
                 {
-                    //Utlis.WriteLine("AddToken 澶辫触");
+                    Utlis.WriteLine("AddToken 澶辫触");
                 }
                 return false;
             }
@@ -1946,15 +1961,18 @@
         /// 鑾峰彇璁惧鍒楄〃
         /// </summary>
         /// <returns></returns>
-        public ResponsePackNew GetDeviceList()
+        public ResponsePackNew GetDeviceList(string pageSize="",string pageNo ="")
         {
             Dictionary<string, object> d = new Dictionary<string, object>();
             d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
             //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);
+            if (!string.IsNullOrEmpty(pageSize))
+            {
+                d.Add("pageSize", pageSize);
+                d.Add("pageNo", pageNo);
+            }
 
             var requestJson = HttpUtil.GetSignRequestJson(d);
             return HttpUtil.RequestHttpsPostFroHome(NewAPI.Api_Post_GetDevcieList, requestJson);
@@ -2610,6 +2628,23 @@
             var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_FL_Check, requestJson);
             return pack;
         }
+        /// <summary>
+        /// 鑾峰彇闂ㄥ彛鏈哄緲寰婃姤璀︽暟鎹�
+        /// </summary>
+        /// <param name="deviceId"></param>
+        /// <returns></returns>
+        public ResponsePackNew GetAlarmRecords(string deviceId,string alarmType = "PROWLER_ALARM")
+        {
+            Dictionary<string, object> d = new Dictionary<string, object>();
+            d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+            d.Add("deviceId", deviceId);
+            d.Add("alarmType", alarmType);
+            var requestJson = HttpUtil.GetSignRequestJson(d);
+            var pack = HttpUtil.RequestHttpsPostFroHome(NewAPI.API_POST_ALARM_RECORDS, requestJson);
+            return pack;
+
+        }
+
         #endregion
 
         #region 鈻� 闂ㄩ攣鐩稿叧____________________________

--
Gitblit v1.8.0