|
@@ -75,26 +75,27 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string,
|
|
|
if r["downUrl"] != nil {
|
|
|
this.Remarks["downUrl"] = r["downUrl"]
|
|
|
this.Remarks["size"] = r["size"]
|
|
|
- if isCanConsume_p {
|
|
|
- //中台消费记录
|
|
|
- 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)))
|
|
|
+ if this.saveJyConsumePackList() {
|
|
|
+ if isCanConsume_p {
|
|
|
+ //中台消费记录
|
|
|
+ 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_free, 1, 60*60*24*31)
|
|
|
+ } else {
|
|
|
+ redis.Incr(jy.PowerCacheDb, mon_free)
|
|
|
}
|
|
|
- }
|
|
|
- } else if isCanConsume_f { //下载后自增一次 免费权限默认存储31d
|
|
|
- if fui == 0 {
|
|
|
- redis.Put(jy.PowerCacheDb, mon_free, 1, 60*60*24*31)
|
|
|
- } else {
|
|
|
- redis.Incr(jy.PowerCacheDb, mon_free)
|
|
|
}
|
|
|
}
|
|
|
- go this.saveJyConsumePackList(qutil.If(isCanConsume_p, true, false).(bool))
|
|
|
} else {
|
|
|
m = "获取附件异常"
|
|
|
}
|
|
@@ -140,7 +141,7 @@ func (this *UseBalanceStruct) FindJyConsumePackRecord() string {
|
|
|
}
|
|
|
|
|
|
//保存日志
|
|
|
-func (this *UseBalanceStruct) saveJyConsumePackList(b bool) {
|
|
|
+func (this *UseBalanceStruct) saveJyConsumePackList() (b bool) {
|
|
|
saveMap := map[string]interface{}{
|
|
|
"s_id": this.Remarks["id"],
|
|
|
"s_userId": this.UserId,
|
|
@@ -155,9 +156,11 @@ func (this *UseBalanceStruct) saveJyConsumePackList(b bool) {
|
|
|
"b_isPay": b,
|
|
|
"s_platform": this.Platform,
|
|
|
}
|
|
|
- if util.MQFW.Save(jyCC, saveMap) == "" {
|
|
|
+ b = util.MQFW.Save(jyCC, saveMap) != ""
|
|
|
+ if !b {
|
|
|
log.Println("保存附件下载日志异常:", this.UserId)
|
|
|
}
|
|
|
+ return
|
|
|
}
|
|
|
|
|
|
//调rpc 获取附件信息
|