From 38f3e04352c40c1b90c8e46159d13a0272cc61f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E4=BF=8A=E5=AE=8F?= <389838709@qq.com> Date: Tue, 6 Aug 2024 16:55:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E8=AF=81=E4=B9=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/console/command.go | 12 ++++++------ app/http/controllers/front/payment_controller.go | 6 +++--- app/http/entities/backend/order.go | 2 +- app/third/paymentService/ali_service.go | 4 ++-- app/third/paymentService/payment_service.go | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/app/console/command.go b/app/console/command.go index 02d5793..6b36b6d 100644 --- a/app/console/command.go +++ b/app/console/command.go @@ -66,9 +66,9 @@ func closeOrder() { req.Ali = paymentService.AliPay{ AppId: orderInfo.AppId, PrivateKey: ali.PrivateKey, - AppPublicCert: []byte(ali.AppPublicCert), - AlipayRootCert: []byte(ali.AlipayRootCert), - AlipayPublicCert: []byte(ali.AlipayPublicCert), + AppPublicCert: ali.AppPublicCert, + AlipayRootCert: ali.AlipayRootCert, + AlipayPublicCert: ali.AlipayPublicCert, } default: utils.Log(nil, "关闭订单,支付渠道不支持", orderInfo.ChannelType) @@ -148,9 +148,9 @@ func queryOrder() { query.Ali = paymentService.AliPay{ AppId: orderInfo.AppId, PrivateKey: ali.PrivateKey, - AppPublicCert: []byte(ali.AppPublicCert), - AlipayRootCert: []byte(ali.AlipayRootCert), - AlipayPublicCert: []byte(ali.AlipayPublicCert), + AppPublicCert: ali.AppPublicCert, + AlipayRootCert: ali.AlipayRootCert, + AlipayPublicCert: ali.AlipayPublicCert, } default: utils.Log(nil, "查询订单,支付渠道不支持", orderInfo.ChannelType) diff --git a/app/http/controllers/front/payment_controller.go b/app/http/controllers/front/payment_controller.go index 4613a93..874999b 100644 --- a/app/http/controllers/front/payment_controller.go +++ b/app/http/controllers/front/payment_controller.go @@ -124,9 +124,9 @@ func AliCallback(c *gin.Context) { } aliConfig.AppId = payChannelModel.AppId aliConfig.PrivateKey = aliConfigModel.PrivateKey - aliConfig.AppPublicCert = []byte(aliConfigModel.AppPublicCert) - aliConfig.AlipayRootCert = []byte(aliConfigModel.AlipayRootCert) - aliConfig.AlipayPublicCert = []byte(aliConfigModel.AlipayPublicCert) + aliConfig.AppPublicCert = aliConfigModel.AppPublicCert + aliConfig.AlipayRootCert = aliConfigModel.AlipayRootCert + aliConfig.AlipayPublicCert = aliConfigModel.AlipayPublicCert notifyReq, err := alipay.ParseNotifyToBodyMap(c.Request) // c.Request 是 gin 框架的写法 if err != nil { diff --git a/app/http/entities/backend/order.go b/app/http/entities/backend/order.go index ae5d5fa..93ba01d 100644 --- a/app/http/entities/backend/order.go +++ b/app/http/entities/backend/order.go @@ -138,7 +138,7 @@ func (o *OrderThirdLogResponse) ResponseFromDb(db orderthirdpaylogmodel.OrderThi o.OrderId = db.OrderId o.PayCallback = db.PayCallback o.Status = db.Status - o.MerchantParam = db.MerchantParam + o.MerchantParam = db.PayParam o.MerchantCallback = db.MerchantCallback o.CreateTime = db.CreateTime.Format("2006-01-02 15:04:05") } diff --git a/app/third/paymentService/ali_service.go b/app/third/paymentService/ali_service.go index 1148d7b..cba07fa 100644 --- a/app/third/paymentService/ali_service.go +++ b/app/third/paymentService/ali_service.go @@ -43,10 +43,10 @@ func AliInitClient(aliConfig AliPay) { // 自动同步验签(只支持证书模式) // 传入 alipayPublicCert.crt 内容 - aliClient.AutoVerifySign(aliConfig.AlipayPublicCert) + aliClient.AutoVerifySign([]byte(aliConfig.AlipayPublicCert)) // 证书内容 - aliClientErr = aliClient.SetCertSnByContent(aliConfig.AppPublicCert, aliConfig.AlipayRootCert, aliConfig.AlipayPublicCert) + aliClientErr = aliClient.SetCertSnByContent([]byte(aliConfig.AppPublicCert), []byte(aliConfig.AlipayRootCert), []byte(aliConfig.AlipayPublicCert)) } // GetAliClient 获取已经初始化的支付宝客户端 diff --git a/app/third/paymentService/payment_service.go b/app/third/paymentService/payment_service.go index 63540f4..266f549 100644 --- a/app/third/paymentService/payment_service.go +++ b/app/third/paymentService/payment_service.go @@ -34,9 +34,9 @@ type WxPay struct { type AliPay struct { AppId string `json:"app_id"` // 应用ID PrivateKey string `json:"private_key"` // 应用私钥 - AppPublicCert []byte `json:"app_public_cert"` // 应用公钥 - AlipayRootCert []byte `json:"alipay_root_cert"` // 支付宝根证书 - AlipayPublicCert []byte `json:"alipay_public_cert"` // 支付宝公钥 + AppPublicCert string `json:"app_public_cert"` // 应用公钥 + AlipayRootCert string `json:"alipay_root_cert"` // 支付宝根证书 + AlipayPublicCert string `json:"alipay_public_cert"` // 支付宝公钥 } type PayOrderResponse struct {