zhuguifei
2025-07-25 85a15646ffe20ed2bbb2042ec500df8c850a69cc
mqtt/MqttView.vue
@@ -41,10 +41,13 @@
            }
            let opts = {
               // #ifdef H5
               url: 'ws://' + this.$api.mqttBaseUrl + ':8083/mqtt',
               url: 'wss://' + this.$api.mqttBaseUrl + ':8084/mqtt',
               // #endif
               // #ifdef MP-WEIXIN
               url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt',// 微信小程序强制 WSS
               // #endif
               // #ifdef APP-PLUS
               url: 'wx://' + this.$api.mqttBaseUrl + ':8083/mqtt',
               url: 'wxs://' + this.$api.mqttBaseUrl + ':8084/mqtt',  // Android/iOS 用普通 WebSocket
               // #endif
               clientId: deviceid,
               username: account.username,
@@ -77,6 +80,29 @@
               console.error(res)
            })
             
            //订阅干燥设备连接断开状态更新-租户内所有设备
            this.$mqttTool.subscribe({
               topic: this.$constant.SERVICE_BROADCAST_TENANT_UPDATE_EQU_STATU.replace('%s', this.tenantId),
               qos: 0
            }).then(res => {
               console.error(res)
            })
            //订阅查询干燥设备连接状态-单个设备
            this.$mqttTool.subscribe({
               topic: this.$constant.SERVICE_RES_EQU_STATU.replace('%s', deviceid),
               qos: 0
            }).then(res => {
               console.error(res)
            })
            //订阅干燥设备实时数据
            this.$mqttTool.subscribe({
               topic: this.$constant.SERVICE_BROADCAST_TENANT_REAL_DATA.replace('%s', this.tenantId),
               qos: 0
            }).then(res => {
               console.error(res)
            })
            //订阅发送指令返回结果
            // this.$mqttTool.subscribe({
            //    topic: this.$constant.SERVICE_RES_EQU_CMD,