pay
All checks were successful
Deploy to Server / deploy (push) Successful in 24s

This commit is contained in:
jeremygan2021
2026-02-14 12:27:49 +08:00
parent f7c033021e
commit a5527e8312
3 changed files with 21 additions and 4 deletions

View File

@@ -741,12 +741,20 @@ class OrderViewSet(viewsets.ModelViewSet):
description = f"报名 {order.course.title}"
else:
description = f"支付订单 {order.id}"
# 强制修正回调地址为正确的后端接口地址
# 用户配置可能是 /pay (前端页面),我们需要的是 /api/finish/ (后端回调接口)
current_notify = wechat_config.notify_url
if 'quant-speed.com' in current_notify:
notify_url = "https://market.quant-speed.com/api/finish/"
else:
notify_url = current_notify # Fallback
print(f"准备发起微信支付(小程序):")
print(f" OutTradeNo: {out_trade_no}")
print(f" Amount: {amount_in_cents}")
print(f" OpenID: {user.openid}")
print(f" NotifyURL: {wechat_config.notify_url}")
print(f" NotifyURL: {notify_url}")
# 统一下单 (JSAPI)
code, message = wxpay.pay(
@@ -754,7 +762,7 @@ class OrderViewSet(viewsets.ModelViewSet):
out_trade_no=out_trade_no,
amount={'total': amount_in_cents, 'currency': 'CNY'},
payer={'openid': user.openid}, # 小程序支付必须传 openid
notify_url=wechat_config.notify_url
notify_url=notify_url
)
print(f"微信支付响应: Code={code}, Message={message}")