Prechádzať zdrojové kódy

Merge branch 'cygx_9.6' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 2 rokov pred
rodič
commit
f2505cbba0
1 zmenil súbory, kde vykonal 19 pridanie a 0 odobranie
  1. 19 0
      controllers/report.go

+ 19 - 0
controllers/report.go

@@ -1523,6 +1523,7 @@ func (this *ReportController) ReportListByType() {
 // @Title 获取报告精选详情
 // @Description 获取报告精选详情接口
 // @Param   ArticleId   query   int  true       "报告ID"
+// @Param   IsBestNew   query   bool  false       "是否获取最新的一篇报告"
 // @Success 200 {object} models.ReportSelectionLetailResp
 // @router /reportSelection/detail [get]
 func (this *ReportController) Detail() {
@@ -1539,6 +1540,24 @@ func (this *ReportController) Detail() {
 	}
 	uid := user.UserId
 	articleId, _ := this.GetInt("ArticleId")
+	isBestNew, _ := this.GetBool("IsBestNew")
+	if isBestNew {
+		tbdb := "cygx_report_selection"
+		reportTypeStr := "bgjx"
+		condition := ` AND publish_status = 1  `
+		var pars []interface{}
+		readSql := ` (SELECT COUNT(1) AS  count  FROM cygx_report_history_record AS h WHERE h.article_id = art.article_id AND  report_type ='` + reportTypeStr + `' AND h.user_id = ` + strconv.Itoa(uid) + `) as read_num`
+		list, err := models.GetReportSelectionListPublic(condition, readSql, tbdb, pars, 0, 1)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range list {
+			articleId = v.ArticleId
+		}
+	}
+
 	if articleId < 0 {
 		br.Msg = "参数错误"
 		br.ErrMsg = "参数错误"