xingzai 1 rok pred
rodič
commit
9a84ac8444
2 zmenil súbory, kde vykonal 19 pridanie a 23 odobranie
  1. 16 16
      controllers/report_billboard.go
  2. 3 7
      models/industry_fllow.go

+ 16 - 16
controllers/report_billboard.go

@@ -62,13 +62,13 @@ func (this *ReportBillboardController) FllowList() {
 	chartPermissionId, _ := this.GetInt("ChartPermissionId")
 
 	// 查询有已归类行业报告的行业IDs
-	activeIndustryIds, e := models.GetActiveArticleIndustryIds()
-	if e != nil {
-		br.Msg = "获取失败"
-		br.ErrMsg = "获取已归类行业失败, Err:" + e.Error()
-		return
-	}
-	activeIndustryLen := len(activeIndustryIds)
+	//activeIndustryIds, e := models.GetActiveArticleIndustryIds()
+	//if e != nil {
+	//	br.Msg = "获取失败"
+	//	br.ErrMsg = "获取已归类行业失败, Err:" + e.Error()
+	//	return
+	//}
+	//activeIndustryLen := len(activeIndustryIds)
 
 	topNum := utils.PageSize15
 	var condition, subCond string
@@ -77,15 +77,15 @@ func (this *ReportBillboardController) FllowList() {
 		condition += ` 	AND man.chart_permission_id = ?  `
 		pars = append(pars, chartPermissionId)
 	}
-	if activeIndustryLen > 0 {
-		condition += ` AND man.industrial_management_id IN (` + utils.GetOrmInReplace(activeIndustryLen) + `)`
-		pars = append(pars, activeIndustryIds)
-	}
-	nowTime := time.Now().Local()
-	startTime := nowTime.AddDate(0, -1, 0)
-	endTime := nowTime.AddDate(0, 0, -1)
-	condition += ` AND idf.create_time BETWEEN ? AND ?`
-	pars = append(pars, startTime, endTime)
+	//if activeIndustryLen > 0 {
+	//	condition += ` AND man.industrial_management_id IN (` + utils.GetOrmInReplace(activeIndustryLen) + `)`
+	//	pars = append(pars, activeIndustryIds)
+	//}
+	//nowTime := time.Now().Local()
+	//startTime := nowTime.AddDate(0, -1, 0)
+	//endTime := nowTime.AddDate(0, 0, -1)
+	//condition += ` AND idf.create_time BETWEEN ? AND ?`
+	//pars = append(pars, startTime, endTime)
 
 	// 查询近一个月至昨日关注度最高的15个产业(不再指定行业, chartPermissionId可筛选行业)
 	list, e := models.GetTopIndustryFollowData(0, topNum, condition, pars)

+ 3 - 7
models/industry_fllow.go

@@ -186,19 +186,15 @@ func GetCountCygxIndustryFllowByUidAndChartPermissionId(userId, ChartPermissionI
 // GetTopIndustryFollowData 获取关注度最高的产业关注数据
 func GetTopIndustryFollowData(startSize, pageSize int, condition string, pars []interface{}) (list []*IndustrialManagement, err error) {
 	sql := `SELECT
-				COUNT(1) AS one_month_follow_num,
 				man.*
 			FROM
-				cygx_industry_fllow AS idf
-			JOIN cygx_industrial_management AS man ON idf.industrial_management_id = man.industrial_management_id
+                cygx_industrial_management AS man 
 			WHERE 1 = 1 `
 	if condition != "" {
 		sql += condition
 	}
-	sql += ` GROUP BY
-				idf.industrial_management_id
-			ORDER BY
-				one_month_follow_num DESC
+	sql += ` ORDER BY
+				one_month_follow_num DESC , man.industrial_management_id DESC 
 			LIMIT ?,?`
 	_, err = orm.NewOrm().Raw(sql, pars, startSize, pageSize).QueryRows(&list)
 	return