|
@@ -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
|