26 lines
385 B
Go
26 lines
385 B
Go
package app
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"net/http"
|
|
)
|
|
|
|
type Gin struct {
|
|
C *gin.Context
|
|
}
|
|
|
|
type Response struct {
|
|
Code int `json:"code"`
|
|
Msg string `json:"msg"`
|
|
Data interface{} `json:"data"`
|
|
}
|
|
|
|
func (g *Gin) CResponse(errCode int, Msg string, data interface{}) {
|
|
g.C.JSON(http.StatusOK, Response{
|
|
Code: errCode,
|
|
Msg: Msg,
|
|
Data: data,
|
|
})
|
|
return
|
|
}
|