|
@@ -1,7 +1,9 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_cygx/models"
|
|
|
+ "hongze/hongze_cygx/utils"
|
|
|
"strconv"
|
|
|
)
|
|
|
|
|
@@ -46,8 +48,8 @@ func (this *ResearchController) NewList() {
|
|
|
}
|
|
|
mapHot := make(map[string]int)
|
|
|
|
|
|
- condition := ` ORDER BY sum_num DESC LIMIT 3 `
|
|
|
- listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition)
|
|
|
+ condition := ` ORDER BY sum_num DESC `
|
|
|
+ listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition, 0, 3)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
@@ -122,6 +124,8 @@ func (this *ResearchController) CollectionList() {
|
|
|
// @Description 主题热度/近期更新更多,列表接口
|
|
|
// @Param ChartPermissionId query int true "分类ID"
|
|
|
// @Param ThemeType query int true "主题类型,1主题热度、2近期更新 默认1"
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
// @Success 200 {object} models.IndustrialManagementHotListResp
|
|
|
// @router /hotList [get]
|
|
|
func (this *ResearchController) HotList() {
|
|
@@ -142,10 +146,20 @@ func (this *ResearchController) HotList() {
|
|
|
br.Msg = "请输入分类ID"
|
|
|
return
|
|
|
}
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize15
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
if themeType != 2 {
|
|
|
themeType = 1
|
|
|
- condition = `ORDER BY sum_num DESC LIMIT 15`
|
|
|
+ condition = `ORDER BY sum_num DESC `
|
|
|
} else {
|
|
|
condition = `ORDER BY publish_date DESC `
|
|
|
}
|
|
@@ -155,7 +169,13 @@ func (this *ResearchController) HotList() {
|
|
|
br.ErrMsg = "获取信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- list, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition)
|
|
|
+ total, err := models.GetThemeHeatListCount(categoryinfo.PermissionName, "")
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ list, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
@@ -180,8 +200,8 @@ func (this *ResearchController) HotList() {
|
|
|
}
|
|
|
mapHot := make(map[string]int)
|
|
|
|
|
|
- condition = ` ORDER BY sum_num DESC LIMIT 3 `
|
|
|
- listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition)
|
|
|
+ condition = ` ORDER BY sum_num DESC `
|
|
|
+ listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition, 0, 3)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
@@ -206,7 +226,9 @@ func (this *ResearchController) HotList() {
|
|
|
list[k].IsHot = true
|
|
|
}
|
|
|
}
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp := new(models.IndustrialManagementHotListResp)
|
|
|
+ resp.Paging = page
|
|
|
resp.List = list
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|