package controllers import ( "eta/eta_mini_crm_ht/models" "eta/eta_mini_crm_ht/models/response" "eta/eta_mini_crm_ht/utils" "github.com/rdlucklib/rdluck_tools/paging" ) type FeedBackController struct { BaseAuthController } // FeedBackList // @Title 研报详情 // @Description 研报详情 // @Param ReportPdfId query string true "pdf研报id" // @Success 200 {object} models.BaseResponse // @router /feedBackList [get] func (this *FeedBackController) FeedBackList() { br := new(models.BaseResponse).Init() defer func() { this.Data["json"] = br this.ServeJSON() }() pageSize, _ := this.GetInt("PageSize") currentIndex, _ := this.GetInt("CurrentIndex") var startSize int if pageSize <= 0 { pageSize = utils.PageSize20 } if currentIndex <= 0 { currentIndex = 1 } startSize = utils.StartIndex(currentIndex, pageSize) total, err := models.GetFeedBackCount() if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,Err:" + err.Error() return } list, err := models.GetFeedBackList(startSize, pageSize) if err != nil { br.Msg = "获取失败" br.ErrMsg = "获取失败,Err:" + err.Error() return } feedBackList := make([]*models.FeedBackView, 0) for _, v := range list { feedBackList = append(feedBackList, &models.FeedBackView{ Mobile: v.Mobile, Message: v.Message, CreatedTime: v.CreatedTime.Format(utils.FormatDateTime), }) } page := paging.GetPaging(currentIndex, pageSize, total) resp := new(response.FeedBackListResp) resp.List = feedBackList resp.Paging = page br.Ret = 200 br.Success = true br.Msg = "获取成功" br.Data = resp }