123456789101112131415161718192021222324252627282930 |
- package app
- import (
- "github.com/gin-gonic/gin"
- "kpt.xdmy/pkg/e"
- )
- type Gin struct {
- C *gin.Context
- }
- func (g *Gin) Response(httpCode, errCode int, data interface{}) {
- g.C.JSON(httpCode, gin.H{
- "code": httpCode,
- "msg": e.GetMsg(errCode),
- "data": data,
- })
- return
- }
- func (g *Gin) ResponseEq(httpCode, errCode int, errorNo int, data interface{}) {
- g.C.JSON(httpCode, gin.H{
- "code": httpCode,
- "message": e.GetMsg(errCode),
- "results": data,
- "errorNo": errorNo,
- "success": 1,
- })
- return
- }
|