From 77a8a26ca9b63b7c28df84970bee41ba2b010a65 Mon Sep 17 00:00:00 2001 From: xce Date: Mon, 19 Jan 2026 01:50:04 +0800 Subject: [PATCH] =?UTF-8?q?mqtt=E6=9E=B6=E6=9E=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/modules/user.js | 8 ++++---- utils/mqtt.js | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/store/modules/user.js b/store/modules/user.js index b72589c..b314fd0 100644 --- a/store/modules/user.js +++ b/store/modules/user.js @@ -94,8 +94,8 @@ const user = { // 退出系统 LogOut({ commit, state }) { return new Promise((resolve, reject) => { - batchUnsubscribe({clientId:mqttUtil.getMqttState().clientId}).then(response => { - if (response.code === 200) { + // batchUnsubscribe({clientId:mqttUtil.getMqttState().clientId}).then(response => { + // if (response.code === 200) { logout(state.token).then(() => { commit('SET_TOKEN', '') commit('SET_ROLES', []) @@ -107,8 +107,8 @@ const user = { reject(error) }) console.info("取消订阅成功!") - } - }) + // } + // }) }) } } diff --git a/utils/mqtt.js b/utils/mqtt.js index 0df6f2e..03a74f2 100644 --- a/utils/mqtt.js +++ b/utils/mqtt.js @@ -302,6 +302,7 @@ export function startMqttOnlinePing(intervalMs = 20000) { const payload = JSON.stringify({ ts: Date.now() }); // qos=0 足够;retain 不要 mqttState.client.publish(topic, payload, { qos: 0, retain: false }); + console.info(`主题:${topic}:${payload}`) } catch (e) {} };