health-go/util/ginRes.go

21 lines
361 B
Go
Raw Normal View History

2024-11-14 01:15:55 +08:00
package util
import "github.com/gin-gonic/gin"
func ReturnJson(c *gin.Context, httpCode int, code int, msg string, data interface{}) {
c.JSON(httpCode, gin.H{
"code": code,
"msg": msg,
"data": data,
})
}
func ReturnInvalid(c *gin.Context) {
response := gin.H{
"code": 4,
"msg": "无效请求参数",
"data": nil,
}
c.JSON(200, response)
}