|
@@ -56,6 +56,14 @@ func (this *BigVipBaseMsg) SubVipPortraitTimesCheck(mysql *mysql.Mysql, entId st
|
|
|
return nil
|
|
|
}
|
|
|
|
|
|
+ //校验本月次数是否使用完
|
|
|
+ useKey := fmt.Sprintf(PortraitRecordTimes, this.Uid, int(now.Month()))
|
|
|
+
|
|
|
+ useCount := redis.GetInt(PowerCacheDb, useKey)
|
|
|
+ if useCount >= fullCount {
|
|
|
+ return fmt.Errorf("本月次数已使用完")
|
|
|
+ }
|
|
|
+
|
|
|
//并发控制
|
|
|
if redis.Incr(PowerCacheDb, fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId)) == 1 {
|
|
|
_ = redis.SetExpire(PowerCacheDb, fmt.Sprintf(UsePortraitVisited, this.Uid, int(now.Month()), entId), 60*60*5)
|
|
@@ -65,14 +73,6 @@ func (this *BigVipBaseMsg) SubVipPortraitTimesCheck(mysql *mysql.Mysql, entId st
|
|
|
fullCount = this.Vip_BuySet.AreaCount * OneAreaTimes
|
|
|
}
|
|
|
|
|
|
- //校验本月次数是否使用完
|
|
|
- useKey := fmt.Sprintf(PortraitRecordTimes, this.Uid, int(now.Month()))
|
|
|
-
|
|
|
- useCount := redis.GetInt(PowerCacheDb, useKey)
|
|
|
- if useCount >= fullCount {
|
|
|
- return fmt.Errorf("本月次数已使用完")
|
|
|
- }
|
|
|
-
|
|
|
//新增使用记录
|
|
|
if mysql.Insert(PortraitRecordTable, map[string]interface{}{
|
|
|
"user_id": this.Uid,
|