Files
Message-Push-Nest/pkg/app/response.go
T
2024-01-01 13:09:44 +08:00

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
}