You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
323 B

  1. package response
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "net/http"
  5. )
  6. type response struct {
  7. code int
  8. data interface{}
  9. msg string
  10. }
  11. const (
  12. ERROR = 7
  13. SUCCESS = 0
  14. )
  15. func Result(code int, data interface{}, msg string, c *gin.Context) {
  16. // 开始时间
  17. c.JSON(http.StatusOK, response{
  18. code,
  19. data,
  20. msg,
  21. })
  22. }