fix: 支付 openid 按俱乐部隔离,禁止跨小程序回落 legacy 字段

appid 已正确读 club 表,但 openid 在无 xq 绑定时会错误回落 UserName/OpenID(可能是星之界 openid),导致 appid 与 openid 不匹配。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
XingQue
2026-07-10 20:47:35 +08:00
parent df416b8284
commit f601541eb0
6 changed files with 64 additions and 19 deletions

View File

@@ -160,12 +160,13 @@ class FaKuanPayView(APIView):
'message': f'支付参数生成失败: {str(e)}'
}, status=status.HTTP_500_INTERNAL_SERVER_ERROR)
else:
pay_openid, _ = get_payment_openid(request)
pay_club = penalty_cz_club_id(fadan)
pay_openid, _ = get_payment_openid(request, club_id=pay_club)
if not pay_openid:
chongzhi_jilu.delete()
return Response({
'code': 400,
'message': '用户openid不存在无法发起微信支付',
'message': '当前小程序未绑定微信openid请退出后重新登录再支付',
}, status=status.HTTP_400_BAD_REQUEST)
try:
pay_params = self.generate_wechat_pay_params(