refactor: adjust project structure
This commit is contained in:
20
util/ginRes.go
Normal file
20
util/ginRes.go
Normal file
@ -0,0 +1,20 @@
|
||||
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)
|
||||
}
|
Reference in New Issue
Block a user