zhangxinlei1996 3 lat temu
rodzic
commit
bbe9b25ee8

+ 3 - 2
src/jfw/modules/subscribepay/src/entity/resourcePackStruct.go

@@ -104,19 +104,20 @@ func (this *resoucePackStruct) Filter(product, userid, lotteryId, discountId str
 		}
 		log.Println(filter)
 		num := qu.IntAll(filter["num"])
-		rs.Product = fmt.Sprintf("附件下载包-%i个", num)
+		products := fmt.Sprintf("附件下载包-%v个", num)
 		price := config.ResConf.AttachmentDownPackPrice[strconv.Itoa(num)]
 		if price == 0 {
 			msg = "金额校验异常"
 		}
 		filter["validTime"] = this.LastDate(time.Now()).Format("2006-01-02")
-		rs = ReturnStruct{Filter: filter, Price: price, OrderMoney: price}
+		rs = ReturnStruct{Filter: filter, Price: price, OrderMoney: price, Product: products}
 	}
 
 	//卡券
 	var discount float64
 	full_price, reduce_price, userLotteryId := 0, 0, ""
 	if lotteryId != "" {
+		log.Println(config.CouponConfig.Products[rs.Product], "~~~", rs.Product)
 		full_price, reduce_price, discount, userLotteryId = util.GetCouponInfo(userid, lotteryId, config.CouponConfig.Products[rs.Product])
 		if full_price <= rs.Price {
 			if discount == 100 {

+ 3 - 2
src/jfw/modules/subscribepay/src/util/coupon.go

@@ -17,6 +17,7 @@ import (
 func GetCouponInfo(userId, lotteryId, pCode string) (full, reduce int, discount float64, userLotteryId string) {
 	lttid := qutil.SE.Decode4Hex(lotteryId)
 	getUrl := fmt.Sprintf("%s?userId=%s&appId=%s&lotteryId=%s", config.CouponConfig.CouponInfo, userId, config.CouponConfig.AppId, lttid)
+	log.Println("url:", getUrl)
 	res, err := http.Get(getUrl)
 	if err != nil {
 		log.Println(err.Error())
@@ -49,7 +50,8 @@ func GetCouponInfo(userId, lotteryId, pCode string) (full, reduce int, discount
 				for _, pv := range useProductList {
 					//当前产品是否可用
 					productCode := strconv.FormatInt(qutil.Int64All(pv["productCode"]), 10) //104
-					if productCode == pCode || string([]rune(pCode)[:3]) == productCode {
+					parentCode := strconv.FormatInt(qutil.Int64All(pv["parentCode"]), 10)
+					if productCode == pCode || string([]rune(pCode)[:3]) == productCode || string([]rune(pCode)[:3]) == parentCode {
 						isExists = true
 						break
 					}
@@ -69,7 +71,6 @@ func GetCouponInfo(userId, lotteryId, pCode string) (full, reduce int, discount
 				endDate = thisTime.Unix()
 			}
 			//未开始 已结束 则不可用
-			log.Println(beginDate, "---", time.Now().Unix(), "---", endDate)
 			if beginDate > time.Now().Unix() || endDate < time.Now().Unix() {
 				isExists = false
 			}