Pārlūkot izejas kodu

fix:修复最新研报

zqbao 9 mēneši atpakaļ
vecāks
revīzija
b590f6657e
2 mainītis faili ar 13 papildinājumiem un 1 dzēšanām
  1. 1 1
      controllers/report.go
  2. 12 0
      models/report.go

+ 1 - 1
controllers/report.go

@@ -484,7 +484,7 @@ func (this *ReportController) RecentList() {
 	}
 	startSize = utils.StartIndex(currentIndex, pageSize)
 
-	total, err := models.GetReportDailyListCount()
+	total, err := models.GetReportRecentListCount()
 	if err != nil {
 		br.Msg = "获取数据失败"
 		br.ErrMsg = "获取数据失败,Err:" + err.Error()

+ 12 - 0
models/report.go

@@ -62,6 +62,18 @@ func GetReportDailyList(startSize, pageSize int) (items []*ReportList, err error
 	return
 }
 
+// GetReportDailyListCount 获得今日报告数量
+func GetReportRecentListCount() (count int, err error) {
+	o := orm.NewOrmUsingDB("rddp")
+	sql := ` SELECT COUNT(*) AS count FROM report 
+				WHERE 1=1 AND (state=2 OR state=6) AND classify_id_second IN (
+				SELECT DISTINCT classify_id
+				FROM chart_permission_search_key_word_mapping
+			)`
+	err = o.Raw(sql).QueryRow(&count)
+	return
+}
+
 func GetReportRecentList(startSize, pageSize int) (items []*ReportList, err error) {
 	o := orm.NewOrmUsingDB("rddp")
 	sql := ` SELECT a.id,a.add_type,a.classify_id_first,a.classify_name_first,a.classify_id_second,a.classify_name_second,a.title,a.abstract,a.author,a.frequency,