|
@@ -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
|
|
|
}
|