报名表单
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),

View File

@@ -100,8 +100,8 @@ DATABASES = {
}
# 从环境变量获取数据库配置 (Docker 环境会自动注入这些变量)
# DB_HOST = os.environ.get('DB_HOST', '121.43.104.161')
DB_HOST = os.environ.get('DB_HOST', '6.6.6.66')
DB_HOST = os.environ.get('DB_HOST', '121.43.104.161')
# DB_HOST = os.environ.get('DB_HOST', '6.6.6.66')
if DB_HOST:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.postgresql',
@@ -109,8 +109,8 @@ if DB_HOST:
'USER': os.environ.get('DB_USER', 'market'),
'PASSWORD': os.environ.get('DB_PASSWORD', '123market'),
'HOST': DB_HOST,
#'PORT': os.environ.get('DB_PORT', '6433'),
'PORT': os.environ.get('DB_PORT', '5432'),
'PORT': os.environ.get('DB_PORT', '6433'),
#'PORT': os.environ.get('DB_PORT', '5432'),
}