浏览代码

Merge branch 'bzq/dev' of eta_mini/eta_mini_api into debug

鲍自强 10 月之前
父节点
当前提交
fbb1ca462a
共有 3 个文件被更改,包括 7 次插入5 次删除
  1. 4 2
      controllers/report.go
  2. 2 2
      models/report.go
  3. 1 1
      models/report_pdf.go

+ 4 - 2
controllers/report.go

@@ -445,7 +445,9 @@ func (this *ReportController) RecentList() {
 		br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
 		return
 	}
-	reportPdfList, err := models.GetReportPdfListByCondition("", []interface{}{}, 0, 3)
+	// 查询已发布的pdf
+	condition := ` AND state=1 `
+	reportPdfList, err := models.GetReportPdfListByCondition(condition, []interface{}{}, 0, 3)
 	if err != nil {
 		br.Msg = "研报列表查询失败"
 		br.ErrMsg = "研报列表查询失败,系统异常,Err:" + err.Error()
@@ -489,7 +491,7 @@ func (this *ReportController) RecentList() {
 			Stage:              v.Stage,
 			Author:             v.Author,
 			ReportType:         utils.ReportTypePdf,
-			PublishTime:        v.PublishTime.Format(utils.FormatDate),
+			PublishTime:        v.PublishTime.Format(utils.FormatDateTime),
 			ModifyTime:         v.ModifyTime,
 		})
 	}

+ 2 - 2
models/report.go

@@ -77,11 +77,11 @@ func (a ByPublishTimeReportView) Less(i, j int) bool {
 	if a[j].PublishTime == "" {
 		return false
 	}
-	aiTime, err := time.Parse(utils.FormatDate, a[i].PublishTime)
+	aiTime, err := time.Parse(utils.FormatDateTime, a[i].PublishTime)
 	if err != nil {
 		return true
 	}
-	ajTime, err := time.Parse(utils.FormatDate, a[j].PublishTime)
+	ajTime, err := time.Parse(utils.FormatDateTime, a[j].PublishTime)
 	if err != nil {
 		return false
 	}

+ 1 - 1
models/report_pdf.go

@@ -60,7 +60,7 @@ func GetReportPdfListByCondition(condition string, pars []interface{}, startSize
 
 func GetReportPdfDailyList() (reportPdfs []*ReportPdf, err error) {
 	o := orm.NewOrm()
-	sql := `SELECT * FROM report_pdf WHERE 1=1 AND DATE(publish_time) = DATE(NOW()) ORDER BY publish_time DESC `
+	sql := `SELECT * FROM report_pdf WHERE 1=1 AND state=1 AND DATE(publish_time) = DATE(NOW()) ORDER BY publish_time DESC `
 	_, err = o.Raw(sql).QueryRows(&reportPdfs)
 	return
 }