瀏覽代碼

近期更新主题,时间精度影响排序的问题

xingzai 2 年之前
父節點
當前提交
fcc295c891
共有 3 個文件被更改,包括 29 次插入6 次删除
  1. 26 3
      controllers/report.go
  2. 2 2
      controllers/research.go
  3. 1 1
      models/report.go

+ 26 - 3
controllers/report.go

@@ -2345,14 +2345,37 @@ func (this *ReportController) SearchResource() {
 			}
 		}
 	}
+	var IndustrialManagementIdStr string
 	for k, v := range listYx {
 		listYx[k].Source = 2
-		for _, v2 := range listSubjcet {
-			if v2.IndustrialManagementId == v.IndustrialManagementId {
-				listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+		IndustrialManagementIdStr += "," + strconv.Itoa(v.IndustrialManagementId)
+		//for _, v2 := range listSubjcet {
+		//	if v2.IndustrialManagementId == v.IndustrialManagementId {
+		//		listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+		//	}
+		//}
+
+	}
+	IndustrialManagementIdStr = strings.TrimLeft(IndustrialManagementIdStr, ",")
+	if IndustrialManagementIdStr != "" {
+		//合并产业关联的标的
+		condition = ` 	AND mg.article_id IN (SELECT mg.article_id FROM cygx_industrial_article_group_management  as mg 
+	INNER JOIN cygx_article as a ON  a.article_id = mg.article_id AND article_type != 'lyjh' WHERE mg.industrial_management_id IN (` + IndustrialManagementIdStr + `) AND mg.article_id >= ` + strconv.Itoa(utils.SummaryArticleId) + ` )`
+		listSubjcet, err = models.GetThemeHeatSubjectList(condition)
+		if err != nil {
+			br.Msg = "获取信息失败"
+			br.ErrMsg = "获取标的信息失败,Err:" + err.Error()
+			return
+		}
+		for k, v := range listYx {
+			for _, v2 := range listSubjcet {
+				if v2.IndustrialManagementId == v.IndustrialManagementId {
+					listYx[k].IndustrialSubjectList = append(listYx[k].IndustrialSubjectList, v2)
+				}
 			}
 		}
 	}
+
 	if keyWord != "" {
 		keyWordItem := new(models.CygxUserSearchKeyWord)
 		keyWordItem.UserId = user.UserId

+ 2 - 2
controllers/research.go

@@ -48,7 +48,7 @@ func (this *ResearchController) NewList() {
 	}
 	mapHot := make(map[string]int)
 
-	condition := ` ORDER BY sum_num DESC  `
+	condition := ` ORDER BY publish_date DESC  `
 	listHot, err := models.GetThemeHeatList(categoryinfo.PermissionName, user.UserId, condition, 0, 3)
 	if err != nil {
 		br.Msg = "获取信息失败"
@@ -158,9 +158,9 @@ func (this *ResearchController) HotList() {
 	startSize = utils.StartIndex(currentIndex, pageSize)
 	var condition string
 	if themeType != 2 {
-		themeType = 1
 		condition = `ORDER BY sum_num DESC `
 	} else {
+		//condition = `ORDER BY sum_num DESC `
 		condition = `ORDER BY publish_date DESC `
 	}
 	categoryinfo, err := models.GetChartPermissionById(chartPermissionId)

+ 1 - 1
models/report.go

@@ -384,7 +384,7 @@ func GetThemeHeatList(permissionName string, userId int, condition string, start
 			m.industry_name,
 			m.industrial_management_id,
 			m.article_read_num,
-            date_format(  MAX( a.publish_date ), '%Y-%m-%d' ) AS publish_date,	
+          	MAX( a.publish_date ) AS publish_date,
 			( SELECT count( 1 ) FROM cygx_industry_fllow AS f  WHERE f.industrial_management_id = m.industrial_management_id  AND user_id =? AND f.type = 1  ) AS fllow_num,
 			m.article_read_num + ( SELECT count( 1 ) FROM cygx_activity_meet_detail_log AS la  WHERE la.activity_id  IN  (SELECT activity_id FROM cygx_industrial_activity_group_management WHERE industrial_management_id = m.industrial_management_id  )) AS sum_num
 		FROM