报名表单
All checks were successful
Deploy to Server / deploy (push) Successful in 36s

This commit is contained in:
jeremygan2021
2026-02-23 15:14:17 +08:00
parent ae91ac47c2
commit 059b57d86d
3 changed files with 23 additions and 10 deletions

View File

@@ -89,14 +89,19 @@ class ActivityViewSet(viewsets.ReadOnlyModelViewSet):
order = pending_order
# Update info if needed? Maybe not.
else:
# 优先从报名信息获取联系方式
contact_name = signup_info.get('name') or signup_info.get('participant_name') or user.nickname or 'Activity User'
contact_phone = signup_info.get('phone') or user.phone_number or ''
order = Order.objects.create(
wechat_user=user,
activity=activity,
total_price=activity.price,
status='pending',
quantity=1,
customer_name=signup_info.get('name') or user.nickname or 'Activity User',
phone_number=signup_info.get('phone') or user.phone_number or '',
customer_name=contact_name,
phone_number=contact_phone,
shipping_address=activity.location or '线下活动', # 使用活动地点作为发货地址
)
# Generate Pay Code
@@ -109,7 +114,7 @@ class ActivityViewSet(viewsets.ReadOnlyModelViewSet):
return Response({'error': f'支付配置错误: {error_msg}'}, status=500)
code, message = wxpay.pay(
description=f"报名: {activity.title}",
description=f"报名活动: {activity.title}",
out_trade_no=out_trade_no,
amount={
'total': int(activity.price * 100),