Эх сурвалжийг харах

Merge remote-tracking branch 'origin/dev4.4.7' into dev4.4.7

# Conflicts:
#	src/jfw/modules/subscribepay/src/coupon.json
wangkaiyue 4 жил өмнө
parent
commit
76b73a3c32

+ 14 - 10
src/jfw/modules/subscribepay/src/coupon.json

@@ -1,12 +1,16 @@
 {
-	"couponUpdate":"http://127.0.0.1:8888/lotteryStateChange",
-	"couponInfo":"http://127.0.0.1:8888/lotteryInfo",
-	"appId":"10000",
-	"products":{
-		"超级订阅":"101",
-		"数据导出":"102",
-		"剑鱼币":"105",
-        "数据流量包": "xxx"
-	},
-	"giveinfo":"http://127.0.0.1:8888/giveInfo"
+  "couponUpdate":"http://127.0.0.1:8888/lotteryStateChange",
+  "couponInfo":"http://127.0.0.1:8888/lotteryInfo",
+  "appId":"10000",
+  "products":{
+    "超级订阅":"101",
+    "数据导出":"102",
+    "剑鱼币":"105",
+    "超级订阅7天":"1011",
+    "超级订阅1个月":"1012",
+    "超级订阅3个月":"1013",
+    "超级订阅12个月":"1014",
+    "数据流量包": "xxx"
+  },
+  "giveinfo":"http://127.0.0.1:8888/giveInfo"
 }

+ 21 - 10
src/jfw/modules/subscribepay/src/service/vipSubscribePay.go

@@ -8,6 +8,7 @@ import (
 	"errors"
 	"fmt"
 	"log"
+	"math"
 	"pay"
 	qutil "qfw/util"
 	"qfw/util/jy"
@@ -31,13 +32,12 @@ type SubVipPayOrder struct {
 func init() {
 	xweb.AddAction(&SubVipPayOrder{})
 }
+
 func (s *SubVipPayOrder) Ts() {
-	log.Println(s.Session().Id())
-	// a, b := util.GiveInfo(s.GetSession("userId").(string), 1012, 0, 280)
-	// log.Println(a, b)
-	log.Println(qutil.ObjToString(s.GetSession("phone")))
-	log.Println(qutil.ObjToString(s.GetSession("s_nickname")))
+	log.Println(s.GetString("abc"))
 
+	log.Println(s.GetString("abcdd"))
+	log.Println(s.GetInt("abcd"))
 }
 
 //支付价格
@@ -177,25 +177,32 @@ func (this *SubVipPayOrder) CreateOrder() {
 		//卡卷信息的id
 		lotteryId := this.GetString("lotteryId")
 		discount_price, userLotteryId := 0, ""
+		useProduct, _ := this.GetInteger("useProduct")
 		if lotteryId != "" {
+			products := config.CouponConfig.Products["超级订阅"]
+			if useProduct > 0 {
+				products = strconv.Itoa(useProduct)
+			}
 			full_price, reduce_price := 0, 0
 			var discount float64
-			full_price, reduce_price, discount, userLotteryId = util.GetCouponInfo(userId, lotteryId, config.CouponConfig.Products["超级订阅"])
+			full_price, reduce_price, discount, userLotteryId = util.GetCouponInfo(userId, lotteryId, products)
 			if discount == 100 { //满减
 				if full_price <= totalfee {
 					totalfee = totalfee - reduce_price
 					discount_price = reduce_price
 				}
 			} else { //满折
-				disCount_int := int(discount * 100)
+				disCount_int := int(math.Ceil(discount * 100))
 				discount_price = totalfee - totalfee*disCount_int/1000
+				log.Println("totalfee1:", totalfee)
 				totalfee = totalfee * disCount_int / 1000
+				log.Println("disCount_int:", disCount_int)
+				log.Println("totalfee2:", totalfee)
 			}
 		}
 		log.Println("discount_price:", discount_price)
 		//赠品相关
 		discountId, _ := this.GetInteger("discountId")
-		useProduct, _ := this.GetInteger("useProduct")
 		if discountId > 0 {
 			isgive = true
 			timeNum, timeType := util.GiveInfo(userId, useProduct, 0, discountId) //获取满赠时长
@@ -270,7 +277,7 @@ func (this *SubVipPayOrder) CreateOrder() {
 }
 
 //续费
-func (this *SubVipPayOrder) Renew() {	
+func (this *SubVipPayOrder) Renew() {
 	userId := qutil.ObjToString(this.GetSession("userId"))
 	r := func() *entity.FuncResult {
 		disWord := this.GetString("disWord")
@@ -379,7 +386,11 @@ func (this *SubVipPayOrder) Renew() {
 			//用户当前使用卡卷
 			full_price, reduce_price := 0, 0
 			var discount float64
-			full_price, reduce_price, discount, userLotteryId = util.GetCouponInfo(userId, lotteryId, config.CouponConfig.Products["超级订阅"])
+			products := config.CouponConfig.Products["超级订阅"]
+			if useProduct > 0 {
+				products = strconv.Itoa(useProduct)
+			}
+			full_price, reduce_price, discount, userLotteryId = util.GetCouponInfo(userId, lotteryId, products)
 			if discount == 100 { //满减
 				if full_price <= totalfee {
 					totalfee = totalfee - reduce_price