From 121c045cf55c647420cb372f717e528c053295ef Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期三, 19 一月 2022 09:24:31 +0800
Subject: [PATCH] 门锁功能修改

---
 HDL_ON/DAL/DriverLayer/Control.cs |   39 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/HDL_ON/DAL/DriverLayer/Control.cs b/HDL_ON/DAL/DriverLayer/Control.cs
index 277b20b..3eafb36 100644
--- a/HDL_ON/DAL/DriverLayer/Control.cs
+++ b/HDL_ON/DAL/DriverLayer/Control.cs
@@ -1,6 +1,7 @@
 锘縰sing System;
 using System.Collections.Generic;
 using System.Text;
+using HDL_ON.DAL.Server;
 using HDL_ON.Entity;
 using HDL_ON.UI;
 using Shared;
@@ -753,7 +754,7 @@
             //2.Body瀛楃涓茶浆涓篵yte鏁扮粍
             byte[] bodyBytes = Encoding.UTF8.GetBytes(bodyDataString);
             //鍒ゆ柇鏄惁闇�鍔犲瘑Body鏁版嵁
-            if (isEncryption && IsLocalEncryptAndGetAesKey)
+            //if (isEncryption && IsLocalEncryptAndGetAesKey)
             {
                 bodyBytes = Securitys.EncryptionService.AesEncryptPayload(bodyBytes, DB_ResidenceData.Instance.CurrentRegion.localSecret);
                 //bodyDataString = Encoding.UTF8.GetString(bodyBytes);
@@ -979,9 +980,11 @@
                         var localFunction = allLocalFuntion.Find((obj) => obj.sid == updateTemp.sid);
                         if (localFunction == null)
                         {
-                            Console.WriteLine("鎵句笉鍒伴煶涔愭挱鏀惧櫒娣�=======" + revString);
+                            MainPage.Log("鎵句笉鍒伴煶涔愭挱鏀惧櫒娣�=======" + revString);
                             continue;
                         }
+                        MainPage.Log(localFunction.name);
+
                         if (Ins.GatewayOnline_Local && isCloudData)//鏈湴閾炬帴锛岄櫎浜嗘秱楦﹁澶囨暟鎹箣澶栫殑浜戠鏁版嵁涓嶅鐞�
                         {
                             if (!SPK.Get3tySpk(SPK.BrandType.All3tyBrand).Contains(localFunction.spk) && !SPK.MusicSpkList().Contains( localFunction.spk))
@@ -1006,7 +1009,7 @@
                         {
                             localFunction.time_stamp = temp.time_stamp;
                             localFunction.SetAttrState(attr.key, attr.value);
-                            Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
+                            //Console.WriteLine("闊充箰鎾斁鍣ㄦ坊鍔犵紦瀛樻暟鎹�=======" + revString);
 
                         }
 
@@ -1211,5 +1214,35 @@
             }
         }
 
+
+
+        #region 闂ㄩ攣
+
+        /// <summary>
+        /// //涓�閿紙杩滅▼锛夊紑閿�
+        /// </summary>
+        public void OneKeyUnlocking(Function doorlock,string extStr)
+        {
+            if (Ins.GatewayOnline_Local)
+            {
+                Dictionary<string, string> dic = new Dictionary<string, string>();
+                var functionControlDataObj = doorlock.GetGatewayAlinkDoorlockData(UserInfo.Current.ID,extStr);
+                var functionControlDataJson = Newtonsoft.Json.JsonConvert.SerializeObject(functionControlDataObj);
+                var sendBytes = Ins.ConvertSendBodyData($"/base/{Control.Ins.GatewayId}/thing/service/doorRemoteOpen/down", functionControlDataJson);
+                new Control_Udp().SendLocalHdlLinkData(sendBytes, functionControlDataObj.id, 0);
+            }
+            else
+            {
+                Dictionary<string, object> d = new Dictionary<string, object>();
+                d.Add("homeId", DB_ResidenceData.Instance.CurrentRegion.id);
+                d.Add("deviceId", doorlock.deviceId);
+                var requestJson = HttpUtil.GetSignRequestJson(d);
+                HttpUtil.RequestHttpsPost("/home-wisdom/app/device/door/remoteOpen", requestJson);
+            }
+        }
+        //瀵嗙爜鍐荤粨
+        //瀵嗙爜楠岃瘉
+
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0