demo.go 300 B

1234567891011121314151617
  1. package controllers
  2. import (
  3. "github.com/gin-gonic/gin"
  4. "goiot-cronapi/common"
  5. "net/http"
  6. "strconv"
  7. )
  8. func Demo(c *gin.Context) {
  9. isErr, _ := strconv.Atoi(c.Query("isErr"))
  10. if isErr == 1 {
  11. common.ReturnError(c, http.StatusBadRequest, "错误")
  12. } else {
  13. common.ReturnSuccess(c, nil)
  14. }
  15. }