From b409d35bc94d3595a47d64317410d722af7d4caf Mon Sep 17 00:00:00 2001 From: wucongxing8150 <815046773@qq.com> Date: Fri, 9 Aug 2024 14:52:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E4=BA=86=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=9B=B8=E5=85=B3=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/service/OrderMember.go | 6 +++--- api/service/OrderSingle.go | 6 +++--- config.yaml | 6 ++++-- config/wechat.go | 14 ++++++++------ 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/api/service/OrderMember.go b/api/service/OrderMember.go index bf0ccfe..1655f4b 100644 --- a/api/service/OrderMember.go +++ b/api/service/OrderMember.go @@ -143,7 +143,7 @@ func (r *OrderMemberService) GetJsapiPrepay(m *model.OrderMember) (prepay *jsapi MchId: config.C.Wechat.Pay1281030301.MchId, Description: "肝病算一算", OutTradeNo: m.OrderNo, - NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.RefundNotifyUrl, + NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.MemberRefundNotifyUrl, Amount: weChat.JsapiRequestAmountRequest{ Total: int64(m.PaymentAmountTotal * 100), Currency: "CNY", @@ -177,7 +177,7 @@ func (r *OrderMemberService) GetAppPrepay(m *model.OrderMember) (prepay *app.Pre MchId: config.C.Wechat.Pay1281030301.MchId, Description: "肝病算一算", OutTradeNo: m.OrderNo, - NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.RefundNotifyUrl, + NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.MemberRefundNotifyUrl, Amount: weChat.AppRequestAmountRequest{ Total: int64(m.PaymentAmountTotal * 100), Currency: "CNY", @@ -229,7 +229,7 @@ func (r *OrderMemberService) OrderRefund(tx *gorm.DB, order *model.OrderMember, Reason: refundReason, RefundAmount: int64(*refundAmount * 100), PaymentAmountTotal: int64(order.PaymentAmountTotal * 100), - NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.RefundNotifyUrl, + NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.MemberRefundNotifyUrl, } refund, err := refundRequest.Refund() diff --git a/api/service/OrderSingle.go b/api/service/OrderSingle.go index c0f9b01..ff464ae 100644 --- a/api/service/OrderSingle.go +++ b/api/service/OrderSingle.go @@ -129,7 +129,7 @@ func (r *OrderSingleService) GetJsapiPrepay(m *model.OrderSingle) (prepay *jsapi MchId: config.C.Wechat.Pay1281030301.MchId, Description: "肝病算一算", OutTradeNo: m.OrderNo, - NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.RefundNotifyUrl, + NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.SingleRefundNotifyUrl, Amount: weChat.JsapiRequestAmountRequest{ Total: int64(m.PaymentAmountTotal * 100), Currency: "CNY", @@ -163,7 +163,7 @@ func (r *OrderSingleService) GetAppPrepay(m *model.OrderSingle) (prepay *app.Pre MchId: config.C.Wechat.Pay1281030301.MchId, Description: "肝病算一算", OutTradeNo: m.OrderNo, - NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.RefundNotifyUrl, + NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.SingleRefundNotifyUrl, Amount: weChat.AppRequestAmountRequest{ Total: int64(m.PaymentAmountTotal * 100), Currency: "CNY", @@ -255,7 +255,7 @@ func (r *OrderSingleService) OrderRefund(tx *gorm.DB, order *model.OrderSingle, Reason: refundReason, RefundAmount: int64(*refundAmount * 100), PaymentAmountTotal: int64(order.PaymentAmountTotal * 100), - NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.RefundNotifyUrl, + NotifyUrl: config.C.Wechat.RefundNotifyDomain + config.C.Wechat.SingleRefundNotifyUrl, } refund, err := refundRequest.Refund() diff --git a/config.yaml b/config.yaml index 374c7ca..78f88ee 100644 --- a/config.yaml +++ b/config.yaml @@ -49,8 +49,10 @@ dysms: wechat: app-id: wx68affaa9d23528f8 app-secret: 2963c90242ddb2421c939591ad9e903d - pay-notify-url: callback/wxpay/single - refund-notify-url: callback/wxpay/inquiry/refund + single-pay-notify-url: callback/wxpay/single # 单项支付回调地址 + single-refund-notify-url: callback/wxpay/inquiry/refund # 单项退款回调地址 + member-pay-notify-url: callback/wxpay/single # 会员支付回调地址 + member-refund-notify-url: callback/wxpay/inquiry/refund # 会员退款回调地址 refund-notify-domain: https://dev-hepa.igandan.com/api/ pay-1281030301: mch-id: 1281030301 diff --git a/config/wechat.go b/config/wechat.go index d03f879..d74e756 100644 --- a/config/wechat.go +++ b/config/wechat.go @@ -1,12 +1,14 @@ package config type Wechat struct { - AppId string `mapstructure:"app-id" json:"app-id" yaml:"patient-app-id"` - AppSecret string `mapstructure:"app-secret" json:"app-secret" yaml:"app-secret"` - PayNotifyUrl string `mapstructure:"pay-notify-url" json:"pay-notify-url" yaml:"pay-notify-url"` - RefundNotifyDomain string `mapstructure:"refund-notify-domain" json:"refund-notify-domain" yaml:"refund-notify-domain"` // 回调域名 - RefundNotifyUrl string `mapstructure:"refund-notify-url" json:"refund-notify-url" yaml:"refund-notify-url"` - Pay1281030301 Pay1281030301 `mapstructure:"pay-1281030301" json:"pay-1281030301" yaml:"pay-1281030301"` + AppId string `mapstructure:"app-id" json:"app-id" yaml:"patient-app-id"` + AppSecret string `mapstructure:"app-secret" json:"app-secret" yaml:"app-secret"` + SinglePayNotifyUrl string `mapstructure:"single-pay-notify-url" json:"single-pay-notify-url" yaml:"single-pay-notify-url"` // 单项支付回调地址 + SingleRefundNotifyUrl string `mapstructure:"single-refund-notify-url" json:"single-refund-notify-url" yaml:"single-refund-notify-url"` // 单项退款回调地址 + MemberPayNotifyUrl string `mapstructure:"member-pay-notify-url" json:"member-pay-notify-url" yaml:"member-pay-notify-url"` // 会员支付回调地址 + MemberRefundNotifyUrl string `mapstructure:"member-refund-notify-url" json:"member-refund-notify-url" yaml:"member-refund-notify-url"` // 会员退款回调地址 + RefundNotifyDomain string `mapstructure:"refund-notify-domain" json:"refund-notify-domain" yaml:"refund-notify-domain"` + Pay1281030301 Pay1281030301 `mapstructure:"pay-1281030301" json:"pay-1281030301" yaml:"pay-1281030301"` } // Pay1281030301 app