Browse Source

支付成功页面新增参数

WH01243 4 months ago
parent
commit
3a712ea8f4

+ 33 - 23
src/jfw/front/commonPayPc.go

@@ -1,15 +1,16 @@
 package front
 
 import (
-	"fmt"
-	"github.com/gogf/gf/v2/util/gconv"
-	"jy/src/jfw/config"
-	"strings"
-	"time"
+    "app.yhyue.com/moapp/jypkg/public"
+    "fmt"
+    "github.com/gogf/gf/v2/util/gconv"
+    "jy/src/jfw/config"
+    "strings"
+    "time"
 
-	qutil "app.yhyue.com/moapp/jybase/common"
+    qutil "app.yhyue.com/moapp/jybase/common"
 
-	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+    "app.yhyue.com/moapp/jybase/go-xweb/xweb"
 )
 
 type JyOrder struct {
@@ -44,22 +45,31 @@ func (this *JyOrder) OrderPay(orderType, orderCode string) error {
 
 // pc支付成功页面
 func (this *JyOrder) PaySuccess(orderType, orderCode string) error {
-	userId := qutil.ObjToString(this.GetSession("userId"))
-	if userId == "" {
-		return this.Redirect("/notin/page")
-	}
-	this.T["payway"] = qutil.If(strings.Index(this.GetString("payway"), "wx") > -1, "微信", "支付宝")
-	this.T["email"] = this.GetString("email")
-	if payTime, err := this.GetInt("payTime"); err == nil {
-		this.T["payTime"] = time.Unix(payTime, 0).Format("2006年01月02日")
-	}
-	positionType := gconv.String(this.GetSession("positionType"))
-	this.T["price"] = this.GetString("price")
-	this.T["shareid"] = "10"
-	this.T["positionType"] = positionType
-	this.T["orderType"] = orderType
-	this.T["orderCode"] = orderCode
-	return this.Render("/order/pc/paySuccess.html")
+    userId := qutil.ObjToString(this.GetSession("userId"))
+    if userId == "" {
+        return this.Redirect("/notin/page")
+    }
+    this.T["payway"] = qutil.If(strings.Index(this.GetString("payway"), "wx") > -1, "微信", "支付宝")
+    this.T["email"] = this.GetString("email")
+    if payTime, err := this.GetInt("payTime"); err == nil {
+        this.T["payTime"] = time.Unix(payTime, 0).Format("2006年01月02日")
+    }
+    positionType := gconv.String(this.GetSession("positionType"))
+    this.T["price"] = this.GetString("price")
+    this.T["shareid"] = "10"
+    this.T["positionType"] = positionType
+    this.T["orderType"] = orderType
+    this.T["orderCode"] = orderCode
+    //订单详情查询
+    data := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+        "order_code": orderCode,
+    }, "vip_type", "")
+    vipType := int64(0)
+    if data != nil && len(*data) > 0 {
+        vipType = gconv.Int64((*data)["vip_type"])
+    }
+    this.T["vipType"] = vipType
+    return this.Render("/order/pc/paySuccess.html")
 }
 
 // 我的订单

+ 17 - 9
src/jfw/front/commonPayWx.go

@@ -84,8 +84,8 @@ func (w *WxPayCommon) PaySuccess(doType string) error {
 	w.T["title"] = "支付"
 	titleArr, exist := titleMap[doType]
 	if exist && t < len(titleArr) {
-		w.T["title"] = titleArr[t]
-	}
+        w.T["title"] = titleArr[t]
+    }
     productType := ""
     if doType == "subvip" {
         productType = "VIP订阅"
@@ -94,13 +94,21 @@ func (w *WxPayCommon) PaySuccess(doType string) error {
     positionType := gconv.String(sessVal["positionType"])
     w.T["productType"] = productType
     w.T["positionType"] = positionType
-	if doType == "dataexport" { //数据导出支付成功
-		return w.Render("/weixin/dataExport/dataExport_paySuccess.html", &w.T)
-	} else if doType == "subvip" { //vip订阅支付成功
-		return w.Render("/weixin/vipsubscribe/vip_pay_success.html")
-	}
-	w.T["doType"] = doType
-	return w.Render("/weixin/commonPay/paySuccess.html", &w.T)
+    data := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+        "order_code": w.GetString("orderCode"),
+    }, "vip_type", "")
+    vipType := int64(0)
+    if data != nil && len(*data) > 0 {
+        vipType = gconv.Int64((*data)["vip_type"])
+    }
+    w.T["vipType"] = vipType
+    if doType == "dataexport" { //数据导出支付成功
+        return w.Render("/weixin/dataExport/dataExport_paySuccess.html", &w.T)
+    } else if doType == "subvip" { //vip订阅支付成功
+        return w.Render("/weixin/vipsubscribe/vip_pay_success.html")
+    }
+    w.T["doType"] = doType
+    return w.Render("/weixin/commonPay/paySuccess.html", &w.T)
 }
 
 func (w *WxPayCommon) ToMyWxOrder() error {

+ 9 - 0
src/jfw/modules/app/src/app/front/commonPay.go

@@ -1,6 +1,7 @@
 package front
 
 import (
+	"app.yhyue.com/moapp/jypkg/public"
 	"errors"
 	"fmt"
 	"github.com/gogf/gf/v2/util/gconv"
@@ -94,6 +95,14 @@ func (w *AppPayCommon) PaySuccess(doType string) error {
 	positionType := gconv.String(sessVal["positionType"])
 	w.T["productType"] = productType
 	w.T["positionType"] = positionType
+	data := public.Mysql.FindOne("dataexport_order", map[string]interface{}{
+		"order_code": w.GetString("orderCode"),
+	}, "vip_type", "")
+	vipType := int64(0)
+	if data != nil && len(*data) > 0 {
+		vipType = gconv.Int64((*data)["vip_type"])
+	}
+	w.T["vipType"] = vipType
 	if doType == "dataexport" { //数据导出支付成功页面
 		return w.Render("/dataExport/dataExport_paySuccess.html", &w.T)
 	} else if doType == "subvip" { //vip订阅支付成功