|
@@ -8,6 +8,7 @@ import (
|
|
|
"math"
|
|
|
qu "qfw/util"
|
|
|
"qfw/util/jy"
|
|
|
+ "qfw/util/redis"
|
|
|
"strconv"
|
|
|
"time"
|
|
|
"util"
|
|
@@ -61,13 +62,22 @@ func (this *resoucePackStruct) PayCallBack(param *CallBackParam) bool {
|
|
|
log.Printf("用户%sPurchaseUserBalance出错:%v", userId, (*orderData)["order_code"], err)
|
|
|
return false
|
|
|
}
|
|
|
+ //附件下载包剩余次数
|
|
|
+ filePackKey := fmt.Sprintf(jy.FilePackNumKey, userId, fmt.Sprint(time.Now().Month()))
|
|
|
+ filePackNum := redis.GetInt(jy.PowerCacheDb, filePackKey)
|
|
|
+ if filePackNum == 0 {
|
|
|
+ redis.Put(jy.PowerCacheDb, filePackKey, qu.IntAll(filterM["num"]), int(this.LastDate(now).Unix()-now.Unix()))
|
|
|
+ } else {
|
|
|
+ filePackNum += qu.IntAll(filterM["num"])
|
|
|
+ redis.Put(jy.PowerCacheDb, filePackKey, filePackNum, int(this.LastDate(now).Unix()-now.Unix()))
|
|
|
+ }
|
|
|
//卡卷使用
|
|
|
userLotteryId := qu.ObjToString((*orderData)["d_relation_id"])
|
|
|
order_code := qu.ObjToString((*orderData)["order_code"])
|
|
|
if userLotteryId != "" {
|
|
|
go func(userId, userLotteryId, order_code string) {
|
|
|
phone, name := util.GetMyPhoneAndName(userId)
|
|
|
- if !util.UpdateCouponState(userId, userLotteryId, name, phone, order_code, "省份订阅包", "0", 1, 0) {
|
|
|
+ if !util.UpdateCouponState(userId, userLotteryId, name, phone, order_code, ATTACHMENT, "0", 1, 0) {
|
|
|
log.Println(fmt.Sprintf("单号%s-消费失败-卡卷%s", order_code, userLotteryId))
|
|
|
}
|
|
|
}(userId, userLotteryId, order_code)
|