Jelajahi Sumber

活动搜索关键词

xingzai 2 tahun lalu
induk
melakukan
935f33765d
1 mengubah file dengan 9 tambahan dan 26 penghapusan
  1. 9 26
      controllers/activity.go

+ 9 - 26
controllers/activity.go

@@ -361,15 +361,15 @@ func (this *ActivityCoAntroller) ActivityList() {
 		keyWordItem.CreateTime = time.Now()
 		go models.AddUserSearchKeyWord(keyWordItem)
 
-		//cacheKey := fmt.Sprint("Search_uid:", user.UserId, "_KeyWord:", keyWordSearch, "_Source:", 6)
-		//isExist := utils.Rc.IsExist(cacheKey)
-		//if !isExist {
-		//	setNX := utils.Rc.SetNX(cacheKey, keyWordSearch, time.Minute*1)
-		//	if !setNX {
-		//		go utils.SendAlarmMsg("记录用户搜索活动关键词失败,设置Redis Key 过期时间失败:key"+cacheKey, 3)
-		//	}
-		//	go services.AddUserSearchLog(user, keyWordSearch, 6)
-		//}
+		cacheKey := fmt.Sprint("Search_uid:", user.UserId, "_KeyWord:", keyWordSearch, "_Source:", 6)
+		isExist := utils.Rc.IsExist(cacheKey)
+		if !isExist {
+			setNX := utils.Rc.SetNX(cacheKey, keyWordSearch, time.Minute*1)
+			if !setNX {
+				go utils.SendAlarmMsg("记录用户搜索活动关键词失败,设置Redis Key 过期时间失败:key"+cacheKey, 3)
+			}
+			go services.AddUserSearchLog(user, keyWordSearch, 6)
+		}
 	}
 	page := paging.GetPaging(currentIndex, pageSize, total)
 	resp := new(models.GetCygxActivityListRep)
@@ -2861,23 +2861,6 @@ func (this *ActivityCoAntroller) ActivityListNew() {
 			resp.Label = detail.ActivityTypeName
 		}
 	}
-	if label != "" {
-		keyWordItem := new(models.CygxUserSearchKeyWord)
-		keyWordItem.UserId = user.UserId
-		keyWordItem.KeyWord = label
-		keyWordItem.PageType = "ActivitSearch"
-		keyWordItem.CreateTime = time.Now()
-		go models.AddUserSearchKeyWord(keyWordItem)
-		cacheKey := fmt.Sprint("Search_uid:", user.UserId, "_KeyWord:", label, "_Source:", 6)
-		isExist := utils.Rc.IsExist(cacheKey)
-		if !isExist {
-			setNX := utils.Rc.SetNX(cacheKey, label, time.Minute*1)
-			if !setNX {
-				go utils.SendAlarmMsg("记录用户搜索活动关键词失败,设置Redis Key 过期时间失败:key"+cacheKey, 3)
-			}
-			go services.AddUserSearchLog(user, label, 6)
-		}
-	}
 	resp.List = list
 	resp.Paging = page
 	br.Ret = 200