From 30105c685a3b63d8921fc7106370a713b032ae7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=85=AC=E5=8F=B8git?= <240241002@qq.com> Date: Fri, 23 Jan 2026 15:10:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(payment):=20=E4=BF=AE=E5=A4=8D=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=AE=9D=E9=80=9A=E7=9F=A5=E7=AD=BE=E5=90=8D=E9=AA=8C?= =?UTF-8?q?=E8=AF=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在支付通知日志中添加接收到的支付宝数据记录 - 移除签名验证参数中的 sign_type,避免验证错误 - 优化支付宝服务签名验证逻辑,提高兼容性和准确度 --- blueprints/payment.py | 1 + services/alipay_service.py | 1 + 2 files changed, 2 insertions(+) diff --git a/blueprints/payment.py b/blueprints/payment.py index ef74597..01d0f75 100644 --- a/blueprints/payment.py +++ b/blueprints/payment.py @@ -169,6 +169,7 @@ def payment_notify(): """支付宝异步通知""" try: data = request.form.to_dict() + system_logger.info(f"Received Alipay Notify: {data}") signature = data.get("sign") if not signature: diff --git a/services/alipay_service.py b/services/alipay_service.py index 1bf5e91..dfe730f 100644 --- a/services/alipay_service.py +++ b/services/alipay_service.py @@ -52,6 +52,7 @@ class AlipayService: # python-alipay-sdk 的 verify 方法会自动处理 sign 的移除 # 但为了保险,我们手动移除它,保留其他所有字段 verify_data.pop('sign', None) + verify_data.pop('sign_type', None) alipay = self.get_alipay_client() # 对于同步回调,sign_type 实际上是参与签名的(某些版本/接口)