From 326a8e72d7bb6def4147fc1e711d3cfa2aa8f4d1 Mon Sep 17 00:00:00 2001
From: wxr <464027401@qq.com>
Date: 星期五, 27 十月 2023 18:33:02 +0800
Subject: [PATCH] 修复Siri Token过期无法刷新的问题
---
HDL_ON/DAL/Mqtt/MqttClient.cs | 60 ++++++++++++------------------------------------------------
1 files changed, 12 insertions(+), 48 deletions(-)
diff --git a/HDL_ON/DAL/Mqtt/MqttClient.cs b/HDL_ON/DAL/Mqtt/MqttClient.cs
index a403e13..51866d6 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,7 +111,7 @@
{
MqttInfoConfig.Current.IfGetMqttInfoSuccess = false;
}
- Control.Ins.GatewayOnline_Cloud = Control.Ins.GatewayOnline_Local = false;
+ //Control.Ins.GatewayOnline_Cloud = Control.Ins.GatewayOnline_Local = false;
await DisConnectRemoteMqttClient(s);
}
@@ -132,6 +133,10 @@
new System.Threading.Thread(async () => {
while (true)
{
+ if (!UserInfo.Current.IsLogin)
+ {
+ return;
+ }
try
{
System.Threading.Thread.Sleep(2000);
@@ -160,7 +165,7 @@
StartCloudMqtt();
}
- static bool isSubscribeSuccess;
+ public static bool isSubscribeSuccess;
/// <summary>
/// 璁㈤槄涓婚
/// </summary>
@@ -262,8 +267,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,
@@ -490,48 +495,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")
@@ -590,7 +553,7 @@
{
var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
var revString = Encoding.UTF8.GetString(bytes);
- MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}");
+ //MainPage.Log($"mqtt 鐘舵�佹洿鏂�:{revString}");
Control.Ins.UpdataFunctionStatus(revString, null, true);
//Control.Ins.MsgInfoList.Add($"mqtt 鐘舵�佹洿鏂�:{revString}");
//Control.Ins.MsgInfoList.Add(revString + "\r\n");
@@ -878,6 +841,7 @@
//娴嬭瘯璐﹀彿锛屼笉鎸や笅绾�
switch (UserInfo.Current.userMobileInfo)
{
+ case "18316672920":
case "15626203746":
case "464027401@qq.com":
return;
@@ -1187,7 +1151,7 @@
}
catch (Exception ex)
{
- Console.WriteLine(ex.Message);
+ MainPage.Log(ex.Message);
}
return reData;
}
--
Gitblit v1.8.0