25 lines
488 B
Go
25 lines
488 B
Go
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,
|
|
})
|
|
}
|