|
@@ -54,8 +54,8 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string)
|
|
|
isCanConsume_f := false
|
|
|
isCanConsume_p := false
|
|
|
//免费赠送已使用次数
|
|
|
- mon := fmt.Sprintf(jy.VipFileUploadNumKey, this.UserId, fmt.Sprint(time.Now().Month()))
|
|
|
- fui := redis.GetInt(jy.PowerCacheDb, mon)
|
|
|
+ mon_free := fmt.Sprintf(jy.VipFileUploadNumKey, this.UserId, fmt.Sprint(time.Now().Month()))
|
|
|
+ fui := redis.GetInt(jy.PowerCacheDb, mon_free)
|
|
|
if fui < config.BidfileConfig.File_number {
|
|
|
isCanConsume_f = true
|
|
|
} else if payCount := this.accountPack(); payCount > 0 { //付费未使用次数
|
|
@@ -71,12 +71,18 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string)
|
|
|
rb, err := this.UseBalance()
|
|
|
if err != nil || (rb != nil && qutil.IntAll(rb["code"]) == 0) {
|
|
|
m = fmt.Sprintf("消费记录保存异常:%s", qutil.ObjToString(rb["message"]))
|
|
|
+ } else {
|
|
|
+ //更新redis 购买附件下载包数量
|
|
|
+ mon_pay := fmt.Sprintf(jy.FilePackNumKey, this.UserId, fmt.Sprint(time.Now().Month()))
|
|
|
+ if redis.GetInt(jy.PowerCacheDb, mon_pay) <= 0 || redis.Decrby(jy.PowerCacheDb, mon_pay, 1) < 0 {
|
|
|
+ log.Println(fmt.Sprintf("附件下载包 消费异常:%s,附件名称:%s", this.UserId, this.Remarks["fileName"].(string)))
|
|
|
+ }
|
|
|
}
|
|
|
} else if isCanConsume_f { //下载后自增一次 免费权限默认存储31d
|
|
|
if fui == 0 {
|
|
|
- redis.Put(jy.PowerCacheDb, mon, 1, 60*60*24*31)
|
|
|
+ redis.Put(jy.PowerCacheDb, mon_free, 1, 60*60*24*31)
|
|
|
} else {
|
|
|
- redis.Incr(jy.PowerCacheDb, mon)
|
|
|
+ redis.Incr(jy.PowerCacheDb, mon_free)
|
|
|
}
|
|
|
}
|
|
|
go this.saveJyConsumePackList(qutil.If(isCanConsume_p, true, false).(bool))
|