瀏覽代碼

Merge branch 'cygx_10.5.1' of http://8.136.199.33:3000/cxzhang/hongze_clpt into debug

xingzai 1 年之前
父節點
當前提交
106ff54fd3
共有 1 個文件被更改,包括 20 次插入18 次删除
  1. 20 18
      services/article_history.go

+ 20 - 18
services/article_history.go

@@ -66,24 +66,26 @@ func ArticleHistoryStopTime(articleId, stopTime, outType int, user *models.WxUse
 	uid := user.UserId
 
 	key := "CYGX_ARTICLE_PV" + strconv.Itoa(articleId) + "_" + strconv.Itoa(uid) + "_" + strconv.Itoa(user.CompanyId) + "_" + strconv.Itoa(outType)
-	record := new(models.CygxArticleHistoryRecordNewpv)
-	record.UserId = uid
-	record.ArticleId = articleId
-	record.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
-	record.ModifyTime = time.Now()
-	record.Mobile = user.Mobile
-	record.Email = user.Email
-	record.CompanyId = user.CompanyId
-	record.CompanyName = user.CompanyName
-	record.StopTime = stopTime
-	record.OutType = outType
-	record.Source = "WEB"
-	_, e := models.AddCygxArticleViewRecordNewpv(record)
-	if e != nil {
-		err = errors.New("AddCygxArticleViewRecordNewpv, Err: " + e.Error())
-		return
+	if !utils.Rc.IsExist(key) {
+		record := new(models.CygxArticleHistoryRecordNewpv)
+		record.UserId = uid
+		record.ArticleId = articleId
+		record.CreateTime = time.Now().Add(-time.Second * time.Duration(stopTime))
+		record.ModifyTime = time.Now()
+		record.Mobile = user.Mobile
+		record.Email = user.Email
+		record.CompanyId = user.CompanyId
+		record.CompanyName = user.CompanyName
+		record.StopTime = stopTime
+		record.OutType = outType
+		record.Source = "WEB"
+		_, e := models.AddCygxArticleViewRecordNewpv(record)
+		if e != nil {
+			err = errors.New("AddCygxArticleViewRecordNewpv, Err: " + e.Error())
+			return
+		}
+		utils.Rc.Put(key, 1, 2*time.Second)
 	}
-	utils.Rc.Put(key, 1, 2*time.Second)
-
+	go ArticleHistoryUserLabelLogAdd(articleId, uid)
 	return
 }