fix: 修复微信支付私钥格式解析问题 - 处理JSON中转义的换行符
This commit is contained in:
parent
6eab35f113
commit
83fd02c4c0
|
|
@ -15,7 +15,7 @@ const ENV = {
|
|||
},
|
||||
// 生产环境 - 部署时修改这里的地址
|
||||
production: {
|
||||
API_BASE_URL: 'https://app.zpc-xy.com/xyqj/api/app',
|
||||
API_BASE_URL: 'https://app.zpc-xy.com/xyqj/api/api/app',
|
||||
STATIC_BASE_URL: 'https://app.zpc-xy.com',
|
||||
ADMIN_API_BASE_URL: 'https://app.zpc-xy.com/xyqj/admin/',
|
||||
SIGNALR_URL: 'wss://app.zpc-xy.com/xyqj/api/hubs/chat'
|
||||
|
|
@ -23,7 +23,7 @@ const ENV = {
|
|||
}
|
||||
|
||||
// 当前环境 - 开发时使用 development,打包时改为 production
|
||||
const CURRENT_ENV = 'development'
|
||||
const CURRENT_ENV = 'production'
|
||||
|
||||
// 导出配置
|
||||
export const config = {
|
||||
|
|
|
|||
|
|
@ -430,7 +430,9 @@ public class WeChatService : IWeChatService
|
|||
private string SignWithPrivateKey(string message)
|
||||
{
|
||||
using var rsa = RSA.Create();
|
||||
rsa.ImportFromPem(_options.Pay.PrivateKey);
|
||||
// 处理 JSON 中转义的换行符
|
||||
var privateKey = _options.Pay.PrivateKey.Replace("\\n", "\n");
|
||||
rsa.ImportFromPem(privateKey);
|
||||
|
||||
var data = Encoding.UTF8.GetBytes(message);
|
||||
var signature = rsa.SignData(data, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user