JLChen
2021-04-01 1ebda09d954de4409c5a7f3ba3c3ee75626ec7c0
HDL_ON/DAL/Mqtt/MqttClient.cs
@@ -258,7 +258,7 @@
            {
                return;
            }
            if(DB_ResidenceData.Instance.CurrentRegion == null || DB_ResidenceData.Instance.CurrentRegion.RegionID == null)
            if (DB_ResidenceData.Instance.CurrentRegion == null || DB_ResidenceData.Instance.CurrentRegion.RegionID == null)
            {
                return;
            }
@@ -287,7 +287,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())
                                {
@@ -337,16 +337,18 @@
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    UI.UI2.PersonalCenter.PirDevice.Method.controldata = revString;
                                    UI.UI2.PersonalCenter.PirDevice.Method.buttondata = revString;
                                }
                                #region 数据更新推送主题
                                //appHomeRefresh:住宅数据刷新通知
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/appHomeRefresh/up") {
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/appHomeRefresh/up")
                                {
                                    MainPage.Log("住宅数据刷新通知");
                                    new HttpServerRequest().GetHomePager();
                                }
                                //appRoomRefresh:房间数据刷新通知
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/appRoomRefresh/up"){
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/appRoomRefresh/up")
                                {
                                    MainPage.Log("房间数据刷新通知");
                                    var roomResult = new HttpServerRequest().GetRoomList();
                                    if (roomResult.Code == StateCode.SUCCESS)
@@ -367,7 +369,8 @@
                                    }
                                }
                                //appDeviceRefresh:设备数据刷新通知
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/appDeviceRefresh/up") {
                                else if (topic == $"/user/{DB_ResidenceData.Instance.CurrentRegion.RegionID}/app/thing/event/appDeviceRefresh/up")
                                {
                                    MainPage.Log("设备数据刷新通知");
                                    var deviceResult = new HttpServerRequest().GetDeviceList();
                                    if (deviceResult.Code == StateCode.SUCCESS)
@@ -418,7 +421,7 @@
                                {
                                    var bytes = Securitys.EncryptionService.AesDecryptPayload(e.ApplicationMessage.Payload, tuyaEncryptKey);
                                    var revString = Encoding.UTF8.GetString(bytes);
                                    Control.Ins.UpdataFunctionStatus(revString, null,true);
                                    Control.Ins.UpdataFunctionStatus(revString, null, true);
                                }
                                //一端口数据解析
                                else
@@ -578,7 +581,7 @@
                    MqttInfoConfig.Current.Save();
                    mqttEncryptKey = MqttInfoConfig.Current.HomeGatewayInfo.aesKey;
                    //解密密钥规则:已现有的住宅ID为基准,从右边一一获取值,最后如果不够16位,则往右补零
                    string aesKey = string.Empty;
@@ -666,7 +669,7 @@
        /// </summary>
        static void ReceiveNotifySqueezeAsync(string mMes)
        {
            if (mMes == PushSignStr ) return;//是自己的登录推送不处理//或者当前不是远程链接状态
            if (mMes == PushSignStr) return;//是自己的登录推送不处理//或者当前不是远程链接状态
            //测试账号,不挤下线
            switch (UserInfo.Current.AccountString)
            {
@@ -984,4 +987,4 @@
    }
}
}