This commit is contained in:
2026-06-12 09:07:41 +08:00
parent 60c4c90a39
commit 3ebb30be76
+10 -2
View File
@@ -375,7 +375,15 @@ def _get_wechat_client(
return None
try:
logger.info("Initializing WeChat Pay with cert_dir=None (no cache)")
# 创建并确保微信支付证书目录存在
wechat_cert_dir = os.path.abspath(os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"..",
"storage",
"wechat_certs"
))
os.makedirs(wechat_cert_dir, exist_ok=True)
logger.info("WeChat Pay platform certificates will be stored in: %s", wechat_cert_dir)
# 初始化微信支付客户端,cert_dir=None,让 SDK 在线获取证书
_wechat_client = WeChatPay(
@@ -386,7 +394,7 @@ def _get_wechat_client(
appid=appid,
apiv3_key=api_v3_key,
notify_url=notify_url,
cert_dir=None, # 不缓存证书,每次都从微信服务器获取
cert_dir=wechat_cert_dir, # 不缓存证书,每次都从微信服务器获取
)
_wechat_mch_id = mch_id
logger.info("WeChat Pay client initialized successfully")