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