|
@@ -1,6 +1,7 @@
|
|
|
package controllers
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"errors"
|
|
|
"github.com/rdlucklib/rdluck_tools/paging"
|
|
|
"hongze/hongze_cygx/models"
|
|
@@ -149,10 +150,10 @@ func (this *ResearchController) HotList() {
|
|
|
}
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
- if themeType != 2 {
|
|
|
- condition = `ORDER BY sum_num DESC `
|
|
|
- } else {
|
|
|
+ if themeType == 2 {
|
|
|
condition = `ORDER BY publish_date DESC `
|
|
|
+ } else {
|
|
|
+ condition = `ORDER BY sum_num DESC `
|
|
|
}
|
|
|
|
|
|
total, err := models.GetThemeHeatListCount("")
|
|
@@ -280,10 +281,10 @@ func (this *ResearchController) KolList() {
|
|
|
}
|
|
|
|
|
|
var condition string
|
|
|
- if themeType != 2 {
|
|
|
- condition = `ORDER BY fllow_num DESC `
|
|
|
- } else {
|
|
|
+ if themeType == 2 {
|
|
|
condition = `ORDER BY sum_num DESC `
|
|
|
+ } else {
|
|
|
+ condition = `ORDER BY fllow_num DESC `
|
|
|
}
|
|
|
|
|
|
list, err := models.GetDepartmentList(condition, user.UserId, startSize, pageSize)
|
|
@@ -597,23 +598,26 @@ func (this *ResearchController) ArticleType() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- var condition string
|
|
|
- condition = " AND is_show_yanx = 1 "
|
|
|
- list, err := models.GetCygxArticleTypeListCondition(condition)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
+ key := utils.YAN_XUAN_TAB_KEY
|
|
|
+ conf, e := models.GetConfigByCode(key)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取首页头部导航失败, Err: " + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- resp := new(models.CygxArticleTypeListResp)
|
|
|
- for _, v := range list {
|
|
|
- item := models.CygxArticleTypeResp{
|
|
|
- ArticleTypeId: v.ArticleTypeId,
|
|
|
- ArticleTypeName: v.ArticleTypeName,
|
|
|
- ButtonStyle: v.ButtonStyle,
|
|
|
- }
|
|
|
- resp.List = append(resp.List, &item)
|
|
|
+ if conf.ConfigValue == "" {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "首页头部导航配置值有误"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ list := new(models.CygxArticleTypeListResp)
|
|
|
+ if e = json.Unmarshal([]byte(conf.ConfigValue), &list); e != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "首页头部导航配置值解析失败, Err: " + e.Error()
|
|
|
+ return
|
|
|
}
|
|
|
+ resp := new(models.CygxArticleTypeListResp)
|
|
|
+ resp = list
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
@@ -651,22 +655,24 @@ func (this *ResearchController) ArticleNewList() {
|
|
|
}
|
|
|
startSize = paging.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
+ var conditiontype string
|
|
|
var pars []interface{}
|
|
|
condition = ` AND publish_status = 1 `
|
|
|
if articleTypeIds == "" {
|
|
|
- var conditiontype string
|
|
|
conditiontype = " AND is_show_yanx = 1 "
|
|
|
- listType, err := models.GetCygxArticleTypeListCondition(conditiontype)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- for _, v := range listType {
|
|
|
- articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
|
|
|
- }
|
|
|
- articleTypeIds = strings.TrimRight(articleTypeIds, ",")
|
|
|
+ } else {
|
|
|
+ conditiontype = ` AND group_id IN (` + articleTypeIds + `) `
|
|
|
+ }
|
|
|
+ listType, err := models.GetCygxArticleTypeListCondition(conditiontype)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ for _, v := range listType {
|
|
|
+ articleTypeIds += strconv.Itoa(v.ArticleTypeId) + ","
|
|
|
}
|
|
|
+ articleTypeIds = strings.TrimRight(articleTypeIds, ",")
|
|
|
condition += ` AND a.article_type_id IN (` + articleTypeIds + `) `
|
|
|
total, err := models.GetArticleResearchCount(condition, pars)
|
|
|
if err != nil {
|