fix bug
This commit is contained in:
24
internal/tick_recv.go
Normal file
24
internal/tick_recv.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package internal
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func TickRecv(c *gin.Context) {
|
||||
data := map[string]any{}
|
||||
|
||||
// Gin 的 Bind 方法会自动根据 Content-Type 解析
|
||||
// 当 Content-Type 为 application/msgpack 时,它会调用 MsgPack 解析器
|
||||
if err := c.Bind(&data); err != nil {
|
||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
||||
return
|
||||
}
|
||||
|
||||
// 处理数据...
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"status": "received",
|
||||
"your_data": data,
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user