feat: UFO H5 服务号 OAuth 登录与同商户公众号 JSAPI 支付

This commit is contained in:
XingQue
2026-07-30 00:12:37 +08:00
parent 531639731a
commit 148a35f04b
11 changed files with 449 additions and 64 deletions

View File

@@ -288,7 +288,7 @@ class ZhuanpanGoumai(APIView):
ZhuanpanJihui.query.filter(czjilu_dingdan_id=dingdanid).delete()
return Response({
'code': 400,
'message': '当前小程序未绑定微信openid请重新登录',
'message': '当前未绑定微信openid请重新登录',
}, status=400)
pay_params = self._wechat_pay_params(request, dingdanid, jine, pay_openid, club_id)
@@ -307,23 +307,27 @@ class ZhuanpanGoumai(APIView):
from jituan.services.wechat_pay import get_wechat_v2_config
from jituan.constants import FUBEI_BIZ_CZJILU
from jituan.services.mini_pay_router import maybe_create_fubei_jsapi_params
from jituan.services.club_user import get_pay_app_source
PAY_DESCRIPTION = getattr(settings, 'ZHUANPAN_PAY_DESCRIPTION', '转盘购票')
NOTIFY_URL = getattr(settings, 'ZHUANPAN_PAY_NOTIFY_URL', '')
app_source = get_pay_app_source(request)
fb_params = maybe_create_fubei_jsapi_params(
club_id=club_id,
out_trade_no=dingdanid,
amount_yuan=jine,
body=PAY_DESCRIPTION,
openid=openid,
notify_url=NOTIFY_URL,
biz_type=FUBEI_BIZ_CZJILU,
)
fb_params = None
if app_source not in ('official', 'h5', 'oa'):
fb_params = maybe_create_fubei_jsapi_params(
club_id=club_id,
out_trade_no=dingdanid,
amount_yuan=jine,
body=PAY_DESCRIPTION,
openid=openid,
notify_url=NOTIFY_URL,
biz_type=FUBEI_BIZ_CZJILU,
)
if fb_params is not None:
return fb_params
pay_cfg = get_wechat_v2_config(club_id)
pay_cfg = get_wechat_v2_config(club_id, app_source=app_source)
APPID = pay_cfg['appid']
MCHID = pay_cfg['mch_id']
KEY = pay_cfg['key']