|
@@ -199,13 +199,14 @@ func (this *MobileResearchController) KolList() {
|
|
|
return
|
|
|
}
|
|
|
var condition string
|
|
|
- if themeType != 2 {
|
|
|
- condition = `ORDER BY fllow_num DESC `
|
|
|
+ var conditionOrder string
|
|
|
+ if themeType == 2 {
|
|
|
+ conditionOrder = `ORDER BY publish_date DESC `
|
|
|
} else {
|
|
|
- condition = `ORDER BY publish_date DESC `
|
|
|
+ conditionOrder = `ORDER BY sum_num DESC `
|
|
|
}
|
|
|
|
|
|
- list, err := models.GetDepartmentList(condition, user.UserId, startSize, pageSize)
|
|
|
+ list, err := models.GetDepartmentList(condition, conditionOrder, user.UserId, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
@@ -261,7 +262,7 @@ func (this *MobileResearchController) HotList() {
|
|
|
br.Ret = 408
|
|
|
return
|
|
|
}
|
|
|
- themeType, _ := this.GetInt("ThemeType", 1)
|
|
|
+ themeType, _ := this.GetInt("ThemeType")
|
|
|
pageSize, _ := this.GetInt("PageSize")
|
|
|
currentIndex, _ := this.GetInt("CurrentIndex")
|
|
|
var startSize int
|
|
@@ -273,55 +274,61 @@ func (this *MobileResearchController) HotList() {
|
|
|
}
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
var condition string
|
|
|
- if themeType == 1 {
|
|
|
- condition = `ORDER BY publish_date DESC `
|
|
|
+ var conditionOrder string
|
|
|
+ articleTypeIds, err := services.GetYanXuanArticleTypeIds()
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetYanXuanArticleTypeIds,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if articleTypeIds == "" {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "研选分类ID不能为空"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ condition = ` AND a.article_type_id IN (` + articleTypeIds + `) `
|
|
|
+ if themeType == 2 {
|
|
|
+ conditionOrder = `ORDER BY publish_date DESC `
|
|
|
} else {
|
|
|
- condition = `ORDER BY sum_num DESC `
|
|
|
+ conditionOrder = `ORDER BY sum_num DESC `
|
|
|
}
|
|
|
- total, err := models.GetThemeHeatListCount("")
|
|
|
+
|
|
|
+ total, err := models.GetThemeHeatListCount(condition)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- list, err := models.GetThemeHeatList(user.UserId, condition, startSize, pageSize)
|
|
|
+ list, err := models.GetThemeHeatList(user.UserId, condition, conditionOrder, startSize, pageSize)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- condition = ` AND a.article_type_id > 0 `
|
|
|
listSubjcet, err := models.GetThemeHeatSubjectList(condition)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- mapHot := make(map[string]int)
|
|
|
- condition = ` ORDER BY sum_num DESC `
|
|
|
- listHot, err := models.GetThemeHeatList(user.UserId, condition, 0, 3)
|
|
|
+ mapHot := make(map[int]bool)
|
|
|
+ mapNew, err := services.GetYanXuanIndustrialManagementIdNewMap(articleTypeIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
+ br.ErrMsg = "GetYanXuanIndustrialManagementIdNewMap,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- for _, v := range listHot {
|
|
|
- mapHot[v.IndustryName] = v.IndustrialManagementId
|
|
|
+ if themeType == 2 {
|
|
|
+ mapHot, err = services.GetYanXuanIndustrialManagementIdHotMap(articleTypeIds)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "GetYanXuanIndustrialManagementIdNewMap,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
- nowTime := time.Now().Local()
|
|
|
- threeMonBefore := nowTime.AddDate(0, -3, 0)
|
|
|
for k, v := range list {
|
|
|
- if v.MinReportTime != "" {
|
|
|
- t, err := time.Parse(utils.FormatDateTime, v.MinReportTime)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取信息失败"
|
|
|
- br.ErrMsg = "报告最早发布时间有误,Err:" + err.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if t.After(threeMonBefore) {
|
|
|
- list[k].IsNew = true
|
|
|
- }
|
|
|
- }
|
|
|
+ list[k].IsNew = mapNew[v.IndustrialManagementId]
|
|
|
+ list[k].IsHot = mapHot[v.IndustrialManagementId]
|
|
|
if v.FllowNum > 0 {
|
|
|
list[k].IsFollow = true
|
|
|
}
|
|
@@ -330,10 +337,6 @@ func (this *MobileResearchController) HotList() {
|
|
|
list[k].IndustrialSubjectList = append(list[k].IndustrialSubjectList, v2)
|
|
|
}
|
|
|
}
|
|
|
- if mapHot[v.IndustryName] > 0 {
|
|
|
- list[k].IsHot = true
|
|
|
- }
|
|
|
- list[k].PublishDate = utils.StrTimeToTime(v.PublishDate).Format(utils.FormatDate) //时间字符串格式转时间格式
|
|
|
}
|
|
|
page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
resp := new(models.IndustrialManagementHotListResp)
|
|
@@ -442,8 +445,15 @@ func (this *MobileResearchController) ThemeDetail() {
|
|
|
resp.IsFollow = true
|
|
|
}
|
|
|
|
|
|
+ listSub, err := models.GetcygxIndustrialSubject(industrialManagementId)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取信息失败"
|
|
|
+ br.ErrMsg = "获取品种信息失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
//处理文章关联的标的
|
|
|
- articleGroupSubjectMap, listSubtect, err := services.GetArticleGroupSubjectMap(articleIds)
|
|
|
+ articleGroupSubjectMap, subjectMap, err := services.GetArticleGroupSubjectMap(articleIds)
|
|
|
if err != nil {
|
|
|
br.Msg = "获取信息失败"
|
|
|
br.ErrMsg = "GetArticleTypeMap Err:" + err.Error()
|
|
@@ -453,9 +463,15 @@ func (this *MobileResearchController) ThemeDetail() {
|
|
|
for k, v := range resp.List {
|
|
|
resp.List[k].ListSubject = articleGroupSubjectMap[v.ArticleId]
|
|
|
}
|
|
|
- resp.ListSubject = listSubtect
|
|
|
}
|
|
|
-
|
|
|
+ for _, v := range listSub {
|
|
|
+ itemSubJect := new(models.IndustrialSubject)
|
|
|
+ itemSubJect.SubjectName = v.SubjectName
|
|
|
+ itemSubJect.IndustrialSubjectId = v.IndustrialSubjectId
|
|
|
+ if subjectMap[v.IndustrialSubjectId] != "" {
|
|
|
+ resp.ListSubject = append(resp.ListSubject, itemSubJect)
|
|
|
+ }
|
|
|
+ }
|
|
|
resp.IndustryName = detailIndustrial.IndustryName
|
|
|
resp.IndustrialManagementId = detailIndustrial.IndustrialManagementId
|
|
|
br.Ret = 200
|