From ac2ee45fadc64fe840bbba6264df3ca4622adb15 Mon Sep 17 00:00:00 2001
From: JLChen <551775569@qq.com>
Date: 星期日, 12 一月 2020 16:06:13 +0800
Subject: [PATCH] 2020-01-12 1.优化修改。

---
 Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs b/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs
index ae7399e..175d451 100644
--- a/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs
+++ b/Crabtree/SmartHome/UI/SimpleControl/MqttCommon.cs
@@ -101,9 +101,12 @@
                                         }
                                         var aesDecryptTopic = e.ApplicationMessage.Topic;
                                         var aesDecryptPayload = e.ApplicationMessage.Payload;
-                                        //Console.WriteLine ("Topic={0}", aesDecryptTopic);
+                                        Console.WriteLine ("Topic={0}", aesDecryptTopic);
 
-                                        if (aesDecryptTopic == $"NotifyBusGateWayInfoChagne/{CurRemoteMACInfo.md5_mac_string}") {//缃戝叧涓婄嚎锛岄渶瑕佹洿鏂癮eskey
+
+                                        //if (aesDecryptTopic == $"NotifyBusGateWayInfoChagne/{CurRemoteMACInfo.md5_mac_string}") {//缃戝叧涓婄嚎锛岄渶瑕佹洿鏂癮eskey
+                                        //2020-01-11 淇敼璁㈤槄涓婚鍦板潃
+                                        if (aesDecryptTopic == $"BusGateWayToClient/{CurRemoteMACInfo.macMark}/NotifyGateWayInfoChange") {//缃戝叧涓婄嚎锛岄渶瑕佹洿鏂癮eskey
                                             Console.WriteLine ("缃戝叧涓婄嚎锛岄渶瑕佹洿鏂癮eskey");
                                             //----绗簩姝ワ細璇诲彇璐﹀彿涓嬮潰鐨勭綉鍏冲垪琛�
                                             var gatewayListUrl = $"{MainPage.RequestHttpsHostMqtt}/Center/Center/GetGatewayPagger"; //App銆丅uspro杞欢鐧诲綍鍚庤幏鍙栫綉鍏冲垪琛� http 璇锋眰
@@ -251,7 +254,7 @@
                                 requestObj3.ReqDto.LoginAccessToken = MainPage.LoginUser.LoginTokenString;
                                 requestObj3.ReqDto.HomeId = UserConfig.Instance.CurrentRegion.Id;
                                 requestObj3.ReqDto.PageSetting.Page = 1;
-                                requestObj3.ReqDto.PageSetting.PageSize = 999;
+                                requestObj3.ReqDto.PageSetting.PageSize = 10;
                                 string urlHead = MainPage.RequestHttpsHost;
                                 if (requestObj3.IsOtherAccountCtrl) {
                                     urlHead = UserConfig.Instance.MasterAccountRequestBaseUrl;
@@ -264,14 +267,8 @@
                                 var revertObj3 = MainPage.RequestHttps (API.GetSingleHomeGatewayPagger, requestJson3, urlHead);
                                 if (revertObj3.StateCode.ToUpper() == "SUCCESS") {
                                     var infoResult = Newtonsoft.Json.JsonConvert.DeserializeObject<GetGatewayResult> (revertObj3.ResponseData.ToString ());
-                                    var gatewayList = infoResult.PageData;
-                                    if (gatewayList != null && gatewayList.Count > 0) {
-                                        if (UserConfig.Instance.CheckHomeGateways ()) {
-                                            UserConfig.Instance.CurrentRegion.HomeGateways [0].GatewayUniqueId = gatewayList [0].GatewayUniqueId;
-                                            UserConfig.Instance.SaveUserConfig ();
-                                            Console.WriteLine ("Remote mqtt get Region MAC : " + gatewayList [0].GatewayUniqueId);
-                                        }
-                                    }
+                                    //2020-01-11
+                                    UserConfig.Instance.SetNowHomeGateways (infoResult.PageData);
                                 } else {
                                     //鎻愮ず閿欒
                                     //GetSingleHomeGatewayPagger
@@ -419,9 +416,11 @@
                         CurRemoteMACInfo.md5_mac_string = builder.ToString ().ToUpper ();
                     }
 
-                    topicName = $"/NotifyBusGateWayInfoChagne/{CurRemoteMACInfo.md5_mac_string}";
+                    //topicName = $"/NotifyBusGateWayInfoChagne/{CurRemoteMACInfo.md5_mac_string}";
+                    //2020-01-11 淇敼璁㈤槄涓婚鍦板潃
+                    topicName = $"BusGateWayToClient/{CurRemoteMACInfo.macMark}/NotifyGateWayInfoChange";
                     //if (remoteIsConnected) {
-                        try {
+                    try {
                             await RemoteMqttClient.SubscribeAsync (topicName);
                         } catch (Exception e) {
                             await DisConnectRemoteMqttClient (e.Message);

--
Gitblit v1.8.0