1
This commit is contained in:
@@ -127,8 +127,6 @@ async def wechat_callback(request: Request, db: AsyncSession = Depends(get_db)):
|
|||||||
signature = headers.get("wechatpay-signature", "")
|
signature = headers.get("wechatpay-signature", "")
|
||||||
serial_no = headers.get("wechatpay-serial", "")
|
serial_no = headers.get("wechatpay-serial", "")
|
||||||
|
|
||||||
# 记录调试信息
|
|
||||||
logger.debug(f"WeChat callback headers - timestamp:{timestamp}, nonce:{nonce[:10] if nonce else ''}, serial_no:{serial_no}")
|
|
||||||
|
|
||||||
# 验证签名:使用平台公钥验证
|
# 验证签名:使用平台公钥验证
|
||||||
if public_key and serial_no:
|
if public_key and serial_no:
|
||||||
@@ -145,7 +143,6 @@ async def wechat_callback(request: Request, db: AsyncSession = Depends(get_db)):
|
|||||||
if not is_verified:
|
if not is_verified:
|
||||||
logger.warning(f"WeChat callback signature verification failed: serial={serial_no}")
|
logger.warning(f"WeChat callback signature verification failed: serial={serial_no}")
|
||||||
raise HTTPException(status_code=400, detail="签名验证失败")
|
raise HTTPException(status_code=400, detail="签名验证失败")
|
||||||
logger.debug(f"WeChat callback signature verified: serial={serial_no}")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.warning(f"WeChat signature verification error: {e}, serial={serial_no}")
|
logger.warning(f"WeChat signature verification error: {e}, serial={serial_no}")
|
||||||
raise HTTPException(status_code=400, detail="签名验证失败")
|
raise HTTPException(status_code=400, detail="签名验证失败")
|
||||||
|
|||||||
Reference in New Issue
Block a user