[feat] 规则链添加切换设备节点

This commit is contained in:
PandaX
2023-10-30 13:56:53 +08:00
parent cac66b9fd0
commit 777ecbd2c0
7 changed files with 94 additions and 21 deletions

View File

@@ -63,6 +63,9 @@ func GetEmqInfo(infoType string) ([]map[string]interface{}, error) {
// Publish 推送信息
func Publish(topic, clientId string, payload interface{}) error {
if clientId == "" {
return errors.New("未获取到MQTT连接")
}
global.Log.Debugf("send data to clientId: %s, topic:%s, payload: %v", clientId, topic, payload)
url := fmt.Sprintf("%s/v5/publish", global.Conf.Mqtt.Broker)
pubData := map[string]interface{}{