|
|
@@ -42,7 +42,10 @@ export class WeixinService {
|
|
|
ApiConfigKit.setCurrentAppId(apiConfig.getAppId)
|
|
|
this.privateKey = fs.readFileSync(this.weixinConfiguration.certPath + 'apiclient_key.pem')
|
|
|
this.publicKey = fs.readFileSync(this.weixinConfiguration.certPath + 'apiclient_cert.pem')
|
|
|
- this.platformPlublicKey = fs.readFileSync(this.weixinConfiguration.certPath + 'platform_cert.pem')
|
|
|
+ if (fs.existsSync(this.weixinConfiguration.certPath + 'platform_cert.pem')) {
|
|
|
+ this.platformPlublicKey = fs.readFileSync(this.weixinConfiguration.certPath + 'platform_cert.pem')
|
|
|
+ }
|
|
|
+ this.getCert()
|
|
|
}
|
|
|
|
|
|
async getAccessToken(): Promise<AccessToken> {
|
|
|
@@ -183,7 +186,7 @@ export class WeixinService {
|
|
|
)
|
|
|
// 保存证书
|
|
|
fs.writeFileSync(certPath, decrypt)
|
|
|
-
|
|
|
+ this.platformPlublicKey = fs.readFileSync(this.weixinConfiguration.certPath + 'platform_cert.pem')
|
|
|
return data
|
|
|
} catch (error) {
|
|
|
Logger.error(error)
|