æ·feat: commplete init process

This commit is contained in:
engigu
2023-12-30 17:40:20 +08:00
parent 9307bec4ab
commit 77af985b76
92 changed files with 12054 additions and 2 deletions
+37
View File
@@ -0,0 +1,37 @@
package app
import (
"github.com/gin-gonic/gin"
"net/http"
"message-nest/pkg/e"
)
type Gin struct {
C *gin.Context
}
type Response struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data interface{} `json:"data"`
}
// Response setting gin.JSON
func (g *Gin) Response(httpCode, errCode int, data interface{}) {
g.C.JSON(httpCode, Response{
Code: errCode,
Msg: e.GetMsg(errCode),
Data: data,
})
return
}
func (g *Gin) CResponse(errCode int, Msg string, data interface{}) {
g.C.JSON(http.StatusOK, Response{
Code: errCode,
Msg: Msg,
Data: data,
})
return
}