1234567891011121314151617181920212223242526 |
- package response
- import (
- "github.com/gin-gonic/gin"
- "net/http"
- )
- type Response struct {
- Code int `json:"code"`
- Data interface{} `json:"data"`
- Msg string `json:"msg"`
- }
- const (
- ERROR = 7
- SUCCESS = 0
- )
- func Result(code int, data interface{}, msg string, c *gin.Context) {
- // 开始时间
- c.JSON(http.StatusOK, Response{
- code,
- data,
- msg,
- })
- }
|