From d76b0e40e5bb127fd33aa1f7842447a1df0628d5 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期日, 30 七月 2023 22:16:34 +0800
Subject: [PATCH] Update PublicAssmeblyBLL.cs

---
 HDL_ON/DAL/Mqtt/MqttClient.cs |   60 +++++++++++-------------------------------------------------
 1 files changed, 11 insertions(+), 49 deletions(-)

diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index 12026aa..f4e129f 100644
--- a/HDL_ON/DAL/Mqtt/MqttClient.cs
+++ b/HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -12,6 +12,7 @@
 using HDL_ON.Entity;
 using HDL_ON.UI;
 using HDL_ON.DAL.Server;
+using HDL_ON;
 
 namespace HDL_ON.DAL.Mqtt
 {
@@ -110,6 +111,7 @@
             {
                 MqttInfoConfig.Current.IfGetMqttInfoSuccess = false;
             }
+            Control.Ins.GatewayOnline_Cloud = Control.Ins.GatewayOnline_Local = false;
             await DisConnectRemoteMqttClient(s);
         }
 
@@ -159,7 +161,7 @@
             StartCloudMqtt();
         }
 
-        static bool isSubscribeSuccess;
+        public static bool isSubscribeSuccess;
         /// <summary>
         /// 璁㈤槄涓婚
         /// </summary>
@@ -261,8 +263,8 @@
                     #endregion
 
 
-                    Utlis.WriteLine("寮�濮嬭闃咃紒");
-                    var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] {
+                    Utlis.WriteLine("寮�濮嬭闃咃紒"); 
+                     var result = await RemoteMqttClient.SubscribeAsync(new MqttTopicFilter[] {
                         pirStatus,pirStudy,
                         appDeviceRefresh,appHomeRefresh,appRoomRefresh,residenceChange,
                         topicFilterPush2, topicAlinkStatus ,mqttkeyChange,
@@ -374,7 +376,7 @@
                             try
                             {
                                 var topic = e.ApplicationMessage.Topic;
-                                //MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
+                                MainPage.Log($"鏀跺埌mqtt涓婚:{topic}");
                                 //涓�绔彛涓婚澶勭悊
                                 if (DB_ResidenceData.Instance.GatewayType == 0 && !DB_ResidenceData.Instance.CheckWhetherGatewayIdIsNull())
                                 {
@@ -460,6 +462,7 @@
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appHomeRefresh/up")
                                 {
                                     MainPage.Log("浣忓畢鏁版嵁鍒锋柊閫氱煡");
+                                    System.Threading.Thread.Sleep(2000);
                                     new HttpServerRequest().GetHomePager();
                                 }
                                 //appRoomRefresh锛氭埧闂存暟鎹埛鏂伴�氱煡
@@ -488,48 +491,6 @@
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/app/thing/event/appDeviceRefresh/up")
                                 {
                                     MainPage.Log("璁惧鏁版嵁鍒锋柊閫氱煡");
-                                    var deviceResult = new HttpServerRequest().GetDeviceList();
-                                    if (deviceResult.Code == StateCode.SUCCESS)
-                                    {
-                                        MainPage.Log($"璇诲彇璁惧淇℃伅鎴愬姛");
-                                        var deviceList = Newtonsoft.Json.JsonConvert.DeserializeObject<DevcieApiPack>(deviceResult.Data.ToString());
-                                        if (deviceList == null)
-                                        {
-                                            deviceList = new DevcieApiPack();
-                                        }
-                                        string delFile = "";
-                                        if (FunctionList.List.GetDeviceFunctionList().Count > 0)
-                                        {
-                                            for (int i = 0; i < FunctionList.List.GetDeviceFunctionList().Count;)
-                                            {
-                                                var localFunction = FunctionList.List.GetDeviceFunctionList()[i];
-                                                if (SPK.MusicSpkList().Contains(localFunction.spk))
-                                                {
-                                                    i++;
-                                                    continue;
-                                                }
-                                                var newFunction = deviceList.list.Find((obj) => obj.deviceId == localFunction.deviceId);
-
-                                                if (delFile == localFunction.savePath)
-                                                {
-                                                    i++;
-                                                    continue;
-                                                }
-                                                delFile = localFunction.savePath;
-                                                FunctionList.List.DeleteFunction(localFunction);
-                                            }
-                                        }
-                                        //澶勭悊鍓╀笅鐨勬柊澧炲姛鑳�
-                                        foreach (var newFunction in deviceList.list)
-                                        {
-                                            newFunction.SaveFunctionFile();
-                                            FunctionList.List.IniFunctionList(newFunction.savePath);
-                                        }
-                                    }
-                                    else
-                                    {
-                                        MainPage.Log($"璇诲彇浜戠璁惧鏁版嵁澶辫触:Code:{deviceResult.Code};  Msg:{deviceResult.message}");
-                                    }
                                 }
                                 //缃戝叧瀵嗛挜鍙樺寲
                                 else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.id}/custom/mqtt/secret/change")
@@ -682,7 +643,7 @@
                 }
                 catch (Exception ex)
                 {
-                    Utlis.WriteLine($"error:" + ex.Message);
+                    Utlis.WriteLine($"mqtt杩炴帴寮傚父 error:" + ex.Message);
                     //mqtt杩炴帴寮傚父锛屾竻绌烘湰鍦癿qtt淇℃伅锛屽彲鑳介渶瑕侀噸鏂拌幏鍙栵細wxr
                     MqttInfoConfig.Current.Refresh();
                 }
@@ -870,12 +831,13 @@
         static void ReceiveNotifySqueezeAsync(string mMes)
         {
 #if DEBUG
-            return;
+            //return;
 #endif
             if (mMes == PushSignStr) return;//鏄嚜宸辩殑鐧诲綍鎺ㄩ�佷笉澶勭悊//鎴栬�呭綋鍓嶄笉鏄繙绋嬮摼鎺ョ姸鎬�
             //娴嬭瘯璐﹀彿锛屼笉鎸や笅绾�
             switch (UserInfo.Current.userMobileInfo)
             {
+                case "18316672920":
                 case "15626203746":
                 case "464027401@qq.com":
                     return;
@@ -1185,7 +1147,7 @@
             }
             catch (Exception ex)
             {
-                Console.WriteLine(ex.Message);
+                MainPage.Log(ex.Message);
             }
             return reData;
         }

--
Gitblit v1.8.0