|
@@ -161,12 +161,12 @@ func CNode(userId string) bool {
|
|
|
var (
|
|
|
limitLogsLock = sync.Mutex{}
|
|
|
limitLogsChan = make(chan struct{}, 4)
|
|
|
- limitLogsCount = 3
|
|
|
+ limitLogsCount = 30
|
|
|
limitLogsData []map[string]interface{}
|
|
|
)
|
|
|
|
|
|
// 免费未留资用户查看公告超过免费次数限制记录
|
|
|
-func SeeDetailLimitLogs(userId, sid string) {
|
|
|
+func SeeDetailLimitLogs(sessUser util.SessUserInfo, sid string) {
|
|
|
limitLogsChan <- struct{}{}
|
|
|
defer func() {
|
|
|
<-limitLogsChan
|
|
@@ -174,9 +174,13 @@ func SeeDetailLimitLogs(userId, sid string) {
|
|
|
//保存日志
|
|
|
limitLogsLock.Lock()
|
|
|
limitLogsData = append(limitLogsData, map[string]interface{}{
|
|
|
- "userId": userId,
|
|
|
- "biddingId": sid,
|
|
|
- "createDate": time.Now().Unix(),
|
|
|
+ "mgoUserId": sessUser.MgoUserId,
|
|
|
+ "phone": sessUser.Phone,
|
|
|
+ "positionId": sessUser.PositionId,
|
|
|
+ "positionType": sessUser.PositionType,
|
|
|
+ "openId": sessUser.OpenId,
|
|
|
+ "biddingId": sid,
|
|
|
+ "createDate": time.Now().Unix(),
|
|
|
})
|
|
|
if len(limitLogsData) > limitLogsCount {
|
|
|
tmp := limitLogsData
|
|
@@ -190,13 +194,14 @@ func SeeDetailLimitLogs(userId, sid string) {
|
|
|
}
|
|
|
|
|
|
// 查看公告详情次数限制
|
|
|
-func SeeDetailLimit(obj map[string]interface{}, userId, sid string) bool {
|
|
|
+func SeeDetailLimit(obj map[string]interface{}, sessUser util.SessUserInfo, sid string) bool {
|
|
|
if obj != nil {
|
|
|
subTypeStr, _ := obj["subtype"].(string)
|
|
|
if strings.Contains(subTypeStr, "拟建") || strings.Contains(subTypeStr, "采购意向") {
|
|
|
return false
|
|
|
}
|
|
|
} else {
|
|
|
+ userId := sessUser.UserId
|
|
|
watchKey := fmt.Sprintf("article_count_%d_%s_%d_%s", time.Now().Year(), time.Now().Month(), time.Now().Day(), userId)
|
|
|
//检验是否留资
|
|
|
if CNode(userId) {
|
|
@@ -218,7 +223,7 @@ func SeeDetailLimit(obj map[string]interface{}, userId, sid string) bool {
|
|
|
}
|
|
|
}
|
|
|
//超过限制次数 记录
|
|
|
- go SeeDetailLimitLogs(userId, sid)
|
|
|
+ go SeeDetailLimitLogs(sessUser, sid)
|
|
|
return false
|
|
|
}
|
|
|
}
|