机器人基本ok

This commit is contained in:
2026-06-12 19:57:34 +08:00
parent 609462252c
commit e16442f348
3 changed files with 58 additions and 2 deletions
+8
View File
@@ -270,6 +270,14 @@ func (s *botService) PublishNodeInfo(_ context.Context, bot botNodeRecord) error
if err := s.server.Publish(topic, raw, false, 0); err != nil {
return err
}
if s.store != nil {
valid, _, record := mqtpp.MQTTPP(topic, raw, key, mqtpp.Options{AllowEncryptedForwarding: true})
if valid && record["type"] == "nodeinfo" {
if err := s.store.UpsertNodeInfo(record); err != nil {
return err
}
}
}
return s.store.UpdateBotNodeInfoBroadcastAt(bot.ID, time.Now())
}