Ver Fonte

test topic

lijian há 1 ano atrás
pai
commit
d59b270048
2 ficheiros alterados com 2 adições e 2 exclusões
  1. 1 1
      pkg/protocol/topic.go
  2. 1 1
      services/emqx-agent/agent.go

+ 1 - 1
pkg/protocol/topic.go

@@ -112,7 +112,7 @@ func parseLast(topics []string) (topicInfo *TopicInfo, err error) {
 
 
 func GetCommandTopic(deviceCode, productKey string) string {
 func GetCommandTopic(deviceCode, productKey string) string {
 	topic := strings.Join([]string{TopicHeadThing, "down", "command", productKey, deviceCode}, "/")
 	topic := strings.Join([]string{TopicHeadThing, "down", "command", productKey, deviceCode}, "/")
-	fmt.Printf("topic:%s", topic)
+	fmt.Printf("topic:%s\r\n", topic)
 	return topic
 	return topic
 }
 }
 
 

+ 1 - 1
services/emqx-agent/agent.go

@@ -236,7 +236,7 @@ func (a *Agent) SendCommand(args rpcs.ArgsSendCommand, reply *rpcs.ReplySendComm
 	if err != nil {
 	if err != nil {
 		return err
 		return err
 	}
 	}
-	return a.client.PublishToMsgToDev(protocol.GetCommandTopic(args.DeviceId, product.RecordId), msg)
+	return a.client.PublishToMsgToDev(protocol.GetCommandTopic(args.DeviceId, product.ProductKey), msg)
 }
 }
 
 
 // GetStatus rpc 获取设备状态
 // GetStatus rpc 获取设备状态