my_chart.go 927 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "eta/eta_mini_api/models"
  5. "eta/eta_mini_api/models/request"
  6. )
  7. type MyChartController struct {
  8. BaseAuthController
  9. }
  10. // @Title List
  11. // @Description create users
  12. // @Param PageSize query int true "每页数据条数"
  13. // @Param CurrentIndex query int true "当前页页码,从1开始"
  14. // @Success 200 {object} models.BaseResponse
  15. // @Failure 403 {object} models.BaseResponse
  16. // @router /collect [get]
  17. func (this *MyChartController) Collect() {
  18. br := new(models.BaseResponse).Init()
  19. defer func() {
  20. this.Data["json"] = br
  21. this.ServeJSON()
  22. }()
  23. var req request.MyChartCollectReq
  24. if err := json.Unmarshal(this.Ctx.Input.RequestBody, &req); err != nil {
  25. br.Msg = "参数解析失败"
  26. br.ErrMsg = "参数解析失败,Err:" + err.Error()
  27. return
  28. }
  29. user := this.User
  30. if user.Status != 2 {
  31. br.Msg = "用户没有权限收藏"
  32. return
  33. }
  34. }