|
@@ -109,6 +109,11 @@ func GetProductInteriorUrlBody(body string) (itemResp []*models.ProductInteriorU
|
|
|
}
|
|
|
|
|
|
func AddCygxProductInteriorHistory(user *models.WxUserItem, articleId int) (err error) {
|
|
|
+ cacheKey := fmt.Sprint("ProductInterior:", user.UserId, "articleId:", articleId)
|
|
|
+ isExist := utils.Rc.IsExist(cacheKey)
|
|
|
+ if isExist {
|
|
|
+ return err
|
|
|
+ }
|
|
|
defer func() {
|
|
|
if err != nil {
|
|
|
go utils.SendAlarmMsg("产品内测用户浏览信息记录失败"+err.Error(), 2)
|
|
@@ -131,6 +136,11 @@ func AddCygxProductInteriorHistory(user *models.WxUserItem, articleId int) (err
|
|
|
historyRecord.SellerName = sellerItem.RealName
|
|
|
}
|
|
|
_, err = models.AddCygxProductInteriorHistory(historyRecord)
|
|
|
+ ////10秒之内的阅读不重复记录
|
|
|
+ setNX := utils.Rc.SetNX(cacheKey, articleId, time.Second*10)
|
|
|
+ if !setNX {
|
|
|
+ go utils.SendAlarmMsg("记录用户搜索关键词失败,设置Redis Key 过期时间失败:key"+cacheKey, 3)
|
|
|
+ }
|
|
|
return
|
|
|
}
|
|
|
|