فهرست منبع

Merge branch 'feature/v4.8.85_ws' of qmx/jy into feature/v4.8.85

wangshan 1 سال پیش
والد
کامیت
6e3b7146e0
1فایلهای تغییر یافته به همراه19 افزوده شده و 12 حذف شده
  1. 19 12
      src/jfw/modules/subscribepay/src/entity/basePack.go

+ 19 - 12
src/jfw/modules/subscribepay/src/entity/basePack.go

@@ -47,6 +47,23 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string,
 	log.Println("附件下载包。。。。。")
 	BaseMsg := jy.GetBigVipUserBaseMsg(this.Session, *config.Middleground)
 	log.Println("---:", this.Remarks)
+	//P450 v4.8.85
+	var freeFileCacheUpdate = func() {
+		//免费用户 更新留资附件缓存
+		if BaseMsg.Status <= 0 && BaseMsg.VipStatus <= 0 && BaseMsg.EntnicheStatus <= 0 {
+			sess := this.Session.GetMultiple()
+			userId := this.UserId
+			if qutil.IntAll(sess["positionId"]) == 1 {
+				userId = strconv.Itoa(qutil.IntAll(sess["positionId"]))
+			}
+			//已留资
+			if c := qutil.Int64All(redis.GetInt("other", fmt.Sprintf("free_article_attach_%s", userId))); c > 0 {
+				if ok := redis.PutKV(fmt.Sprintf("free_article_attach_%s", userId), -1); !ok {
+					log.Println("free user update file  download power  false:", userId)
+				}
+			}
+		}
+	}
 	//获取余额数量
 	dbs := &FindBalanceStruct{
 		AccountId:    this.UserId,
@@ -58,6 +75,7 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string,
 	if data == nil || err != nil {
 		c = -1
 		m = "余额不足"
+		go freeFileCacheUpdate()
 		return
 	}
 	number := 0
@@ -83,18 +101,7 @@ func (this *UseBalanceStruct) fileConsume() (r map[string]interface{}, m string,
 			isExists = true
 		}
 	}
-	//P450 v4.8.85
-	//免费用户 清除留资附件缓存
-	if BaseMsg.Status <= 0 && BaseMsg.VipStatus <= 0 && BaseMsg.EntnicheStatus <= 0 {
-		sess := this.Session.GetMultiple()
-		userId := this.UserId
-		if qutil.IntAll(sess["positionId"]) == 1 {
-			userId = strconv.Itoa(qutil.IntAll(sess["positionId"]))
-		}
-		if ok := redis.PutKV(fmt.Sprintf("free_article_attach_%s", userId), 1); !ok {
-			log.Println("free user clear file  download power  false:", userId)
-		}
-	}
+	go freeFileCacheUpdate()
 	if BaseMsg.Status > 0 && BaseMsg.PowerMap[3] {
 		if this.Remarks["infoType"] != nil && this.Remarks["infoType"].(string) == "S" {
 			r = SupplyInfoFile(_fileName, _id)