12345678910111213141516171819202122232425262728293031 |
- package app
- import (
- "github.com/gin-gonic/gin"
- "../../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
- }
|