后台,rsa生成密钥调整,关闭订单fix

This commit is contained in:
wolter 2024-08-08 15:44:02 +08:00
parent e5f50423ad
commit 39e64c8a22
2 changed files with 9 additions and 5 deletions

View File

@ -82,11 +82,10 @@ func closeOrder() {
// 发起关闭订单请求
response := paymentService.OrderClose(ctx, req)
// 成功
if response.Code == payCommon.PAY_SUCCESS_CODE {
orderIds = append(orderIds, orderInfo.Id)
} else {
utils.Log(nil, "关闭订单,上游失败", response)
if response.Code != payCommon.PAY_SUCCESS_CODE {
utils.Log(nil, "关闭订单,上游失败", response, orderInfo.Id)
}
orderIds = append(orderIds, orderInfo.Id)
}
// 修改订单状态为关闭
cond = builder.NewCond()

View File

@ -8,6 +8,7 @@ import (
"encoding/base64"
"encoding/pem"
"fmt"
"strings"
)
// parseRSAPublicKeyFromPEM 解析PEM编码的RSA公钥
@ -136,5 +137,9 @@ func GenerateKey() (string, string, error) {
Bytes: derPkix,
}
pubPem := pem.EncodeToMemory(pubBlock)
return string(pubPem), string(privPem), nil
pri := strings.Replace(string(privPem), "-----BEGIN RSA PRIVATE KEY-----\n", "", -1)
pri = strings.Replace(pri, "\n-----END RSA PRIVATE KEY-----\n", "", -1)
pub := strings.Replace(string(pubPem), "-----BEGIN PUBLIC KEY-----\n", "", -1)
pub = strings.Replace(pub, "\n-----END PUBLIC KEY-----\n", "", -1)
return pub, pri, nil
}