index.go 1000 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. package api
  2. import (
  3. "Gwen/http/response"
  4. "github.com/gin-gonic/gin"
  5. "net/http"
  6. )
  7. type Index struct {
  8. }
  9. // Index 首页
  10. // @Tags 首页
  11. // @Summary 首页
  12. // @Description 首页
  13. // @Accept json
  14. // @Produce json
  15. // @Success 200 {object} response.Response
  16. // @Failure 500 {object} response.Response
  17. // @Router / [get]
  18. func (i *Index) Index(c *gin.Context) {
  19. response.Success(
  20. c,
  21. "Hello Gwen",
  22. )
  23. }
  24. // Heartbeat 心跳
  25. // @Tags 首页
  26. // @Summary 心跳
  27. // @Description 心跳
  28. // @Accept json
  29. // @Produce json
  30. // @Success 200 {object} nil
  31. // @Failure 500 {object} response.Response
  32. // @Router /heartbeat [post]
  33. func (i *Index) Heartbeat(c *gin.Context) {
  34. //b := &gin.H{}
  35. //err := c.BindJSON(b)
  36. //body : &map[id:ljwzhuwo modified_at:0 uuid:NGIxZTZjM2YtNmNkMy00YTMwLWFiNjQtMzQ0MTA0NGE5ZDgz ver:1.003e+06]
  37. //fmt.Println(b, err, c.Request.Header)
  38. //header : map[Accept:[*/*] Accept-Encoding:[gzip] Content-Length:[105] Content-Type:[application/json]]
  39. c.JSON(http.StatusOK, gin.H{})
  40. }