Files
game-driver/internal/routes/command.go
2024-11-01 17:40:34 +08:00

22 lines
364 B
Go

package routes
import (
"game-driver/internal/common"
"game-driver/leaf"
"log"
)
func Command(d *common.Device) leaf.HandlerFunc {
return func(c *leaf.Context) {
cmd := string(c.Payload)
switch cmd {
case "stop":
common.GlobalStopper.Stop()
case "status":
d.PublishStatus()
default:
log.Printf("接收到无效指令: %s\n", cmd)
}
}
}