完善功能

This commit is contained in:
2025-07-16 15:16:40 +08:00
parent b2871ec0d2
commit f68a5b360b
123 changed files with 4643 additions and 931 deletions

18
utility/mqtt/mqtt.go Normal file
View File

@ -0,0 +1,18 @@
package mqtt
import "context"
type MQTTClient interface {
Publish(ctx context.Context, topic string, payload interface{}) error
Subscribe(topic string, handler func(payload interface{})) error
}
var clients = make(map[string]MQTTClient)
func RegisterClient(name string, client MQTTClient) {
clients[name] = client
}
func GetMQTTClient(name string) MQTTClient {
return clients[name]
}