|
|
@@ -97,14 +97,12 @@ func RequestEpay(c *gin.Context) {
|
|
|
c.JSON(200, gin.H{"message": "error", "data": "充值金额过低"})
|
|
|
return
|
|
|
}
|
|
|
- payType := "wxpay"
|
|
|
- if req.PaymentMethod == "zfb" {
|
|
|
- payType = "alipay"
|
|
|
- }
|
|
|
- if req.PaymentMethod == "wx" {
|
|
|
- req.PaymentMethod = "wxpay"
|
|
|
- payType = "wxpay"
|
|
|
+
|
|
|
+ if !setting.ContainsPayMethod(req.PaymentMethod) {
|
|
|
+ c.JSON(200, gin.H{"message": "error", "data": "支付方式不存在"})
|
|
|
+ return
|
|
|
}
|
|
|
+
|
|
|
callBackAddress := service.GetCallbackAddress()
|
|
|
returnUrl, _ := url.Parse(setting.ServerAddress + "/console/log")
|
|
|
notifyUrl, _ := url.Parse(callBackAddress + "/api/user/epay/notify")
|
|
|
@@ -116,7 +114,7 @@ func RequestEpay(c *gin.Context) {
|
|
|
return
|
|
|
}
|
|
|
uri, params, err := client.Purchase(&epay.PurchaseArgs{
|
|
|
- Type: payType,
|
|
|
+ Type: req.PaymentMethod,
|
|
|
ServiceTradeNo: tradeNo,
|
|
|
Name: fmt.Sprintf("TUC%d", req.Amount),
|
|
|
Money: strconv.FormatFloat(payMoney, 'f', 2, 64),
|