使接口的回应固定格式为
{
"status": 0,
"msg": "ok",
"data": {}
}使用
import (
"github.com/gin-gonic/gin"
"github.com/go-eyas/toolkit/gin/util"
)
func HelloHandler(c *gin.Context) {
util.R(c).OK(gin.H{
"hello": "world",
})
// 将会响应为
// {
// "status": 0,
// "msg": "ok",
// "data": {
// "hello": "world",
// }
// }
}