|
@@ -399,3 +399,109 @@ func (this *ChartController) ChartTop() {
|
|
|
br.Success = true
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+// @Title 季度列表
|
|
|
+// @Description 季度列表接口
|
|
|
+// @Param PageSize query int true "每页数据条数"
|
|
|
+// @Param CurrentIndex query int true "当前页页码,从1开始"
|
|
|
+// @Success 200 {object} models.HomeChartListItem
|
|
|
+// @router /jidu [get]
|
|
|
+func (this *ChartController) Jidu() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ user := this.User
|
|
|
+ if user == nil {
|
|
|
+ br.Msg = "请重新登录"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+ mobile := user.Mobile
|
|
|
+ uid := user.UserId
|
|
|
+ pageSize, _ := this.GetInt("PageSize")
|
|
|
+ currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
+ var startSize int
|
|
|
+ if pageSize <= 0 {
|
|
|
+ pageSize = utils.PageSize20
|
|
|
+ }
|
|
|
+ if currentIndex <= 0 {
|
|
|
+ currentIndex = 1
|
|
|
+ }
|
|
|
+ startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
+
|
|
|
+ resp := new(models.HomeChartListItem)
|
|
|
+ if mobile == "" {
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, 0)
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+ resp.IsBindingMobile = false
|
|
|
+ return
|
|
|
+ } else {
|
|
|
+ resp.IsBindingMobile = true
|
|
|
+ }
|
|
|
+ var listCollection []*models.HomeChartListResp
|
|
|
+ var total int
|
|
|
+ var err error
|
|
|
+ chartUserTokenByMobile, _ := services.GetUserTokenByMobile(mobile)
|
|
|
+ chartIds := "5424,5422,5423,5426"
|
|
|
+ if chartUserTokenByMobile != "" {
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+ condition = ` AND a.chart_id IN (` + chartIds + `) `
|
|
|
+ total, err = models.GetChartCollentCount(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.Msg = "获取帖子总数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listCollection, err = models.GetChartListCollection(chartIds, uid, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.Msg = "获取信息失败,GetChartListCollection Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ total, err = models.GetChartCountByUser(uid)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.Msg = "获取总数失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ listCollection, err = models.GetChartListCollectionWithCygx(uid, startSize, pageSize)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.Msg = "获取信息失败,GetChartListCollection Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for k, v := range listCollection {
|
|
|
+ if v.NumTop > 0 {
|
|
|
+ listCollection[k].IsTop = true
|
|
|
+ }
|
|
|
+ listCollection[k].Source = 2
|
|
|
+ if v.PtagName != "" {
|
|
|
+ listCollection[k].CtagNamePc = v.PtagName
|
|
|
+ }
|
|
|
+ if v.CtagName != "" {
|
|
|
+ listCollection[k].CtagNamePc += "," + v.CtagName
|
|
|
+ }
|
|
|
+ if v.PtagNameTwo != "" {
|
|
|
+ listCollection[k].CtagNamePc += "," + v.PtagNameTwo
|
|
|
+ }
|
|
|
+ if v.CtagNameTwo != "" {
|
|
|
+ listCollection[k].CtagNamePc += "," + v.CtagNameTwo
|
|
|
+ }
|
|
|
+ }
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ resp.List = listCollection
|
|
|
+ resp.Paging = page
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "获取成功"
|
|
|
+ br.Data = resp
|
|
|
+}
|