123456789101112131415161718192021222324252627282930313233 |
- package app
- import (
- "github.com/gin-gonic/gin"
- "github.com/kptyun/KPTCOMM/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,
- "status": 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,
- "status": httpCode,
- "message": e.GetMsg(errCode),
- "msg": e.GetMsg(errCode),
- "results": data,
- "errorNo": errorNo,
- "success": 1,
- })
- return
- }
|