mirror of
https://github.com/linux-do/new-api.git
synced 2025-09-19 08:56:37 +08:00
fix epay bug
This commit is contained in:
parent
a10f7cfbe1
commit
381c354313
@ -64,11 +64,13 @@ func RequestEpay(c *gin.Context) {
|
|||||||
user, _ := model.GetUserById(id, false)
|
user, _ := model.GetUserById(id, false)
|
||||||
amount := GetAmount(float64(req.Amount), *user)
|
amount := GetAmount(float64(req.Amount), *user)
|
||||||
|
|
||||||
|
var payType epay.PurchaseType
|
||||||
if req.PaymentMethod == "zfb" {
|
if req.PaymentMethod == "zfb" {
|
||||||
req.PaymentMethod = "alipay"
|
payType = epay.Alipay
|
||||||
}
|
}
|
||||||
if req.PaymentMethod == "wx" {
|
if req.PaymentMethod == "wx" {
|
||||||
req.PaymentMethod = "wxpay"
|
req.PaymentMethod = "wxpay"
|
||||||
|
payType = epay.WechatPay
|
||||||
}
|
}
|
||||||
|
|
||||||
returnUrl, _ := url.Parse(common.ServerAddress + "/log")
|
returnUrl, _ := url.Parse(common.ServerAddress + "/log")
|
||||||
@ -81,7 +83,7 @@ func RequestEpay(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
uri, params, err := client.Purchase(&epay.PurchaseArgs{
|
uri, params, err := client.Purchase(&epay.PurchaseArgs{
|
||||||
Type: epay.PurchaseType(req.PaymentMethod),
|
Type: payType,
|
||||||
ServiceTradeNo: "A" + tradeNo,
|
ServiceTradeNo: "A" + tradeNo,
|
||||||
Name: "B" + tradeNo,
|
Name: "B" + tradeNo,
|
||||||
Money: strconv.FormatFloat(payMoney, 'f', 2, 64),
|
Money: strconv.FormatFloat(payMoney, 'f', 2, 64),
|
||||||
|
Loading…
Reference in New Issue
Block a user