resp.go 466 B

12345678910111213141516171819202122
  1. package util
  2. import (
  3. "net/http"
  4. "youngee_b_api/consts"
  5. "youngee_b_api/model/http_model"
  6. "github.com/gin-gonic/gin"
  7. )
  8. func PackErrorResp(c *gin.Context, status int32) {
  9. resp := http_model.CommonResponse{
  10. Status: status,
  11. Message: consts.GetErrorToast(status),
  12. Data: nil,
  13. }
  14. c.JSON(http.StatusOK, resp)
  15. }
  16. func HandlerPackErrorResp(resp *http_model.CommonResponse, status int32) {
  17. resp.Status = status
  18. resp.Message = consts.GetErrorToast(status)
  19. }