feed_back.go 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. package controllers
  2. import (
  3. "eta/eta_mini_crm_ht/models"
  4. "eta/eta_mini_crm_ht/models/response"
  5. "eta/eta_mini_crm_ht/utils"
  6. "github.com/rdlucklib/rdluck_tools/paging"
  7. )
  8. type FeedBackController struct {
  9. BaseAuthController
  10. }
  11. // FeedBackList
  12. // @Title 研报详情
  13. // @Description 研报详情
  14. // @Param ReportPdfId query string true "pdf研报id"
  15. // @Success 200 {object} models.BaseResponse
  16. // @router /feedBackList [get]
  17. func (this *FeedBackController) FeedBackList() {
  18. br := new(models.BaseResponse).Init()
  19. defer func() {
  20. this.Data["json"] = br
  21. this.ServeJSON()
  22. }()
  23. pageSize, _ := this.GetInt("PageSize")
  24. currentIndex, _ := this.GetInt("CurrentIndex")
  25. var startSize int
  26. if pageSize <= 0 {
  27. pageSize = utils.PageSize20
  28. }
  29. if currentIndex <= 0 {
  30. currentIndex = 1
  31. }
  32. startSize = utils.StartIndex(currentIndex, pageSize)
  33. total, err := models.GetFeedBackCount()
  34. if err != nil {
  35. br.Msg = "获取失败"
  36. br.ErrMsg = "获取失败,Err:" + err.Error()
  37. return
  38. }
  39. list, err := models.GetFeedBackList(startSize, pageSize)
  40. if err != nil {
  41. br.Msg = "获取失败"
  42. br.ErrMsg = "获取失败,Err:" + err.Error()
  43. return
  44. }
  45. feedBackList := make([]*models.FeedBackView, 0)
  46. for _, v := range list {
  47. feedBackList = append(feedBackList, &models.FeedBackView{
  48. Mobile: v.Mobile,
  49. Message: v.Message,
  50. CreatedTime: v.CreatedTime.Format(utils.FormatDateTime),
  51. })
  52. }
  53. page := paging.GetPaging(currentIndex, pageSize, total)
  54. resp := new(response.FeedBackListResp)
  55. resp.List = feedBackList
  56. resp.Paging = page
  57. br.Ret = 200
  58. br.Success = true
  59. br.Msg = "获取成功"
  60. br.Data = resp
  61. }