Browse Source

后台研选分享的报告阅读记录使用另一张表

xingzai 2 years ago
parent
commit
eea80f8200
1 changed files with 12 additions and 22 deletions
  1. 12 22
      controllers/article.go

+ 12 - 22
controllers/article.go

@@ -647,28 +647,18 @@ func (this *ArticleControllerMobile) DetailMd5() {
 			}
 			if hasPersion {
 				hasPermission = 1
-				historyRecord := new(models.CygxArticleHistoryRecord)
-				historyRecord.UserId = uid
-				historyRecord.ArticleId = articleId
-				historyRecord.CreateTime = time.Now()
-				historyRecord.Mobile = user.Mobile
-				historyRecord.Email = user.Email
-				historyRecord.CompanyId = user.CompanyId
-				historyRecord.CompanyName = user.CompanyName
-				recordCount, _ := models.GetNoAddStoptimeArticleCount(uid, articleId)
-				if recordCount == 0 {
-					go models.AddCygxArticleHistoryRecord(historyRecord)
-				} else {
-					detailNew, err := models.GetNewArticleHistoryRecord(uid, articleId)
-					if err != nil {
-						br.Msg = "获取信息失败"
-						br.ErrMsg = "获取信息失败,Err:" + err.Error()
-						return
-					}
-					if detailNew.StopTime > 0 {
-						go models.AddCygxArticleHistoryRecord(historyRecord)
-					}
-				}
+				record := new(models.CygxArticleHistoryRecordNewpv)
+				record.UserId = uid
+				record.ArticleId = articleId
+				record.CreateTime = time.Now()
+				record.ModifyTime = time.Now()
+				record.Mobile = user.Mobile
+				record.Email = user.Email
+				record.CompanyId = user.CompanyId
+				record.CompanyName = user.CompanyName
+				//新增浏览记录
+				go models.AddCygxArticleViewRecordNewpv(record)
+
 				//30分钟之内阅读同一篇文章不错二次推送
 				key := "CYGX_ARTICLE_READ" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid)
 				if !utils.Rc.IsExist(key) {