瀏覽代碼

同步master 分支

xingzai 3 年之前
父節點
當前提交
45e6fc199e
共有 2 個文件被更改,包括 4 次插入1 次删除
  1. 1 0
      controllers/article.go
  2. 3 1
      models/user.go

+ 1 - 0
controllers/article.go

@@ -94,6 +94,7 @@ func (this *ArticleController) Detail() {
 			return
 		}
 		detail.Body = html.UnescapeString(detail.Body)
+		detail.Body = strings.Replace(detail.Body, "pre", "div", -1)
 		//detail.Abstract = html.UnescapeString(detail.Abstract)
 		detail.Abstract, _ = services.GetReportContentTextSub(detail.Abstract)
 		if companyPermission == "" {

+ 3 - 1
models/user.go

@@ -174,7 +174,9 @@ type ArticleInterviewApplyListResp struct {
 }
 
 func GetArticleUserBrowseHistoryCount(userId int, endDate string) (count int, err error) {
-	sql := `SELECT COUNT(1) AS count FROM cygx_article_history_record AS a WHERE a.user_id=? AND a.create_time>=? `
+	sql := `SELECT COUNT( 1 ) as count
+			FROM
+			( SELECT count(*) FROM cygx_article_history_record AS a WHERE a.user_id = ? AND a.create_time >= ? GROUP BY a.article_id ) b  `
 	err = orm.NewOrm().Raw(sql, userId, endDate).QueryRow(&count)
 	return
 }