设备控制
parent
237ab647ab
commit
30d7a21b60
|
|
@ -318,7 +318,7 @@ export default {
|
|||
if ((e === 'A' || e==='B' || e==='C')
|
||||
&& store.getters && store.getters.name === 'admin' ) {
|
||||
this.getNewSpecialData(e);
|
||||
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/862538065276061${MQTT_TOPIC_SUFFIX.UP}`;
|
||||
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/862538065276061`;
|
||||
}
|
||||
const selectedItem = this.range.find(item => item.value === e);
|
||||
if (selectedItem) {
|
||||
|
|
@ -328,7 +328,7 @@ export default {
|
|||
if (e !== 'A' && e!=='B' && e!=='C') {
|
||||
// 优化:使用常量拼接MQTT主题
|
||||
this.publishTopic = `frontend/${clientId}${MQTT_TOPIC_SUFFIX.DOWN}/${this.imei}`;
|
||||
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/${this.imei}${MQTT_TOPIC_SUFFIX.UP}`;
|
||||
this.mqttConfig.subscribeTopic = `frontend/${clientId}/dtu/${this.imei}`;
|
||||
var queryParams = {
|
||||
imei: this.imei
|
||||
}
|
||||
|
|
@ -563,7 +563,8 @@ export default {
|
|||
// 消息回调逻辑完全保留(仅依赖全局工具类转发消息)
|
||||
ackMessage(topic, payload) {
|
||||
// 1. 先判断是否是目标订阅主题(如frontend/\\w+/control/\\w+")
|
||||
if (topic !== this.mqttConfig.subscribeTopic) return;
|
||||
if ((topic !== this.mqttConfig.subscribeTopic+"/ack")
|
||||
&& (topic !== this.mqttConfig.subscribeTopic+"/listener")) return;
|
||||
let msgData = {};
|
||||
// 优化:捕获JSON解析异常
|
||||
try {
|
||||
|
|
|
|||
Loading…
Reference in New Issue