|
@@ -9,6 +9,7 @@ import (
|
|
|
chartInfoModel "hongze/hongze_yb/models/tables/chart_info"
|
|
|
"hongze/hongze_yb/models/tables/yb_config"
|
|
|
"hongze/hongze_yb/models/tables/yb_my_chart"
|
|
|
+ "hongze/hongze_yb/services"
|
|
|
userService "hongze/hongze_yb/services/user"
|
|
|
"hongze/hongze_yb/utils"
|
|
|
"strconv"
|
|
@@ -36,9 +37,17 @@ func (this *MyChartController) List(c *gin.Context) {
|
|
|
cond += ` AND my_chart_classify_id = ?`
|
|
|
pars = append(pars, req.ClassifyId)
|
|
|
}
|
|
|
+ pageIndex := services.GetCurrPageByClaims(c)
|
|
|
+ pageSize := services.GetPageSizeByClaims(c)
|
|
|
|
|
|
ob := new(yb_my_chart.YbMyChart)
|
|
|
- list, e := ob.List(cond, pars)
|
|
|
+ chartTotal, e := ob.Count(cond, pars)
|
|
|
+ if e != nil {
|
|
|
+ response.FailMsg("获取失败", "获取用户图表列表总数失败, Err:"+e.Error(), c)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ total := int(chartTotal)
|
|
|
+ list, e := ob.PageList(cond, pars, pageIndex, pageSize)
|
|
|
if e != nil {
|
|
|
response.FailMsg("获取失败", "获取用户图表列表失败, Err:"+e.Error(), c)
|
|
|
return
|
|
@@ -58,7 +67,11 @@ func (this *MyChartController) List(c *gin.Context) {
|
|
|
CreateTime: utils.TimeTransferString(utils.FormatDateTime, list[i].CreateTime),
|
|
|
})
|
|
|
}
|
|
|
- response.OkData("获取成功", respList, c)
|
|
|
+
|
|
|
+ response.OkData("获取成功", &responseModel.MyChartListResp{
|
|
|
+ List: respList,
|
|
|
+ Paging: responseModel.GetPaging(pageIndex, pageSize, total),
|
|
|
+ }, c)
|
|
|
}
|
|
|
|
|
|
// Collect 收藏图表
|