From 8ac01cf6e5a739c7ec66eb3514b60de649b52980 Mon Sep 17 00:00:00 2001 From: "qiyunfanbo126.com" <815699> Date: Wed, 10 Jul 2024 13:50:24 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/third/youchu/youchu_api.go | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/third/youchu/youchu_api.go b/app/third/youchu/youchu_api.go index 5b8e380..6b2678d 100644 --- a/app/third/youchu/youchu_api.go +++ b/app/third/youchu/youchu_api.go @@ -173,9 +173,17 @@ func EncryptRequest(request interface{}) (RequestData front.YouChuRequest) { } func DecryptResponse(response string, isRequest bool) (Rsponse string) { - MerchantId := config.GetConf().YouChuCallBack.MerchantId - PrivateKey := config.GetConf().YouChuCallBack.PrivateKey - PublicKey := config.GetConf().YouChuCallBack.SopPublicKey + var MerchantId, PrivateKey, PublicKey string + if isRequest { + MerchantId = config.GetConf().YouChuCallBack.MerchantId + PrivateKey = config.GetConf().YouChuCallBack.PrivateKey + PublicKey = config.GetConf().YouChuCallBack.SopPublicKey + } else { + MerchantId = config.GetConf().YouChu.MerchantId + PrivateKey = config.GetConf().Sm2.PrivateKey + PublicKey = config.GetConf().YouChu.SopPublicKey + } + encrypt, err := postbank.Decrypt(MerchantId, PrivateKey, PublicKey, response, isRequest) if err != nil { return Rsponse