fix: WeChat login Content-Type header, ASR tiny model, re-upload mini-program v1.0.11
This commit is contained in:
@@ -21,8 +21,11 @@ export class WechatPayService {
|
||||
this.logger.warn('微信支付配置不完整,支付功能不可用')
|
||||
}
|
||||
const certDir = path.resolve(__dirname, '../../certs')
|
||||
if (!fs.existsSync(certDir)) {
|
||||
this.logger.error(`证书目录不存在: ${certDir}`)
|
||||
return
|
||||
}
|
||||
this.privateKey = fs.readFileSync(path.join(certDir, 'apiclient_key.pem'), 'utf8')
|
||||
// 从证书中提取序列号
|
||||
const cert = fs.readFileSync(path.join(certDir, 'apiclient_cert.pem'), 'utf8')
|
||||
const certObj = new crypto.X509Certificate(cert)
|
||||
this.mchSerialNo = certObj.serialNumber
|
||||
@@ -122,6 +125,10 @@ export class WechatPayService {
|
||||
// 1. 验签
|
||||
const message = `${wechatTimestamp}\n${wechatNonce}\n${JSON.stringify(body)}\n`
|
||||
const certDir = path.resolve(__dirname, '../../certs')
|
||||
if (!fs.existsSync(certDir)) {
|
||||
this.logger.error(`证书目录不存在: ${certDir}`)
|
||||
return null
|
||||
}
|
||||
const platformCert = fs.readFileSync(path.join(certDir, 'pub_key.pem'), 'utf8')
|
||||
const verify = crypto.createVerify('RSA-SHA256').update(message)
|
||||
const isValid = verify.verify(platformCert, wechatSignature, 'base64')
|
||||
|
||||
Reference in New Issue
Block a user