更新:1、依赖升级
2、module 名称地址
This commit is contained in:
@@ -1,9 +1,11 @@
|
||||
package monitor
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"log"
|
||||
"net/http"
|
||||
"zhub/internal/zbus"
|
||||
|
||||
"gitea.1216.top/lxy/zhub/internal/zbus"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
var r = gin.Default()
|
||||
@@ -39,11 +41,20 @@ func StartWatch() {
|
||||
zbus.Bus.ReloadTimer()
|
||||
c.JSON(http.StatusOK, "+reload timer ok")
|
||||
})
|
||||
r.GET("/topic/publish", func(c *gin.Context) {
|
||||
topic := c.Query("topic")
|
||||
value := c.Query("value")
|
||||
r.POST("/message/send", func(c *gin.Context) {
|
||||
topic := c.PostForm("name") // c.Query("topic")
|
||||
value := c.PostForm("value") // c.Query("value")
|
||||
// _type := c.PostForm("type") // publish、broadcast
|
||||
|
||||
zbus.Bus.Publish(topic, value)
|
||||
log.Println(c.PostForm("type"), topic, value)
|
||||
switch c.PostForm("type") {
|
||||
case "broadcast":
|
||||
zbus.Bus.Broadcast(topic, value)
|
||||
case "publish":
|
||||
zbus.Bus.Publish(topic, value)
|
||||
default:
|
||||
|
||||
}
|
||||
c.JSON(http.StatusOK, "+OK")
|
||||
})
|
||||
r.GET("/topic/delay", func(c *gin.Context) {
|
||||
|
||||
Reference in New Issue
Block a user