Browse Source

Merge branch 'master' of http://8.136.199.33:3000/hongze/hongze_cygx into debug

xingzai 1 year ago
parent
commit
4ab80cf8c7
2 changed files with 26 additions and 14 deletions
  1. 11 11
      services/activity_signup.go
  2. 15 3
      services/page_history_record.go

+ 11 - 11
services/activity_signup.go

@@ -58,17 +58,17 @@ func CheckActivitySignUpLimit(user *models.WxUserItem, activityInfo *models.Acti
 			return
 		}
 	}
-	totalRestrict, e := models.GetUserRestrictCount(user.Mobile)
-	if e != nil {
-		err = errors.New("GetUserRestrictCount, Err: " + e.Error())
-		return
-	}
-	if totalRestrict >= 1 {
-		signupStatus = "BreakPromise"
-		popupMsg = "由于爽约次数过多,您暂时被限制报名资格,请联系对口销售"
-		failType = 3
-		return
-	}
+	//totalRestrict, e := models.GetUserRestrictCount(user.Mobile)
+	//if e != nil {
+	//	err = errors.New("GetUserRestrictCount, Err: " + e.Error())
+	//	return
+	//}
+	//if totalRestrict >= 1 {
+	//	signupStatus = "BreakPromise"
+	//	popupMsg = "由于爽约次数过多,您暂时被限制报名资格,请联系对口销售"
+	//	failType = 3
+	//	return
+	//}
 	return
 
 }

+ 15 - 3
services/page_history_record.go

@@ -35,14 +35,26 @@ func AddCygxPageHistoryRecord(user *models.WxUserItem, Ctx *context.Context) {
 		item.PageRouter = pr.PageRouter
 	}
 	if strings.Contains(item.Router, "/api/article/detail") {
+		//cacheKey := fmt.Sprint("uid:", user.UserId, "_Parameter:", item.Parameter)
+		//isExist := utils.Rc.IsExist(cacheKey)
+		//if !isExist {
+		//	setNX := utils.Rc.SetNX(cacheKey, user.Mobile, time.Second*10)
+		//	if !setNX {
+		//		go utils.SendAlarmMsg("记录用户阅读文章,设置Redis Key 过期时间失败:key"+cacheKey, 3)
+		//	}
+		//	return
+		//}
+
 		cacheKey := fmt.Sprint("uid:", user.UserId, "_Parameter:", item.Parameter)
 		isExist := utils.Rc.IsExist(cacheKey)
-		if !isExist {
-			setNX := utils.Rc.SetNX(cacheKey, user.Mobile, time.Second*10)
+		if isExist {
+			return
+		}
+		setNX := utils.Rc.SetNX(cacheKey, user.Mobile, time.Second*10)
+		if !setNX {
 			if !setNX {
 				go utils.SendAlarmMsg("记录用户阅读文章,设置Redis Key 过期时间失败:key"+cacheKey, 3)
 			}
-			return
 		}
 	}