admin自动审核
This commit is contained in:
@@ -109,7 +109,6 @@ 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', '5432'),
|
||||
}
|
||||
|
||||
@@ -123,7 +122,6 @@ if DB_HOST:
|
||||
# 'PASSWORD': os.environ.get('DB_PASSWORD', '123market'),
|
||||
# 'HOST': DB_HOST,
|
||||
# 'PORT': os.environ.get('DB_PORT', '6433'),
|
||||
|
||||
# }
|
||||
|
||||
|
||||
|
||||
@@ -96,4 +96,39 @@ def notify_user_order_shipped(order):
|
||||
|
||||
print(f"准备发送用户发货通知: {order.phone_number}")
|
||||
#send_sms(order.phone_number, "SMS_501650557", params)
|
||||
send_sms(order.phone_number, "SMS_501665569", params)
|
||||
send_sms(order.phone_number, "SMS_501665569", params)
|
||||
|
||||
def notify_user_activity_signup_success(order, signup):
|
||||
"""
|
||||
通知用户活动报名成功 (支付成功后)
|
||||
模板CODE: SMS_501990528
|
||||
模板变量: user_nick, unit_name, time, address
|
||||
"""
|
||||
if not order.phone_number:
|
||||
return
|
||||
|
||||
# 1. user_nick
|
||||
user_nick = order.customer_name
|
||||
if order.wechat_user and order.wechat_user.nickname:
|
||||
user_nick = order.wechat_user.nickname
|
||||
|
||||
# 2. unit_name (Activity Title)
|
||||
unit_name = signup.activity.title
|
||||
|
||||
# 3. time
|
||||
start_time = signup.activity.start_time
|
||||
# Format time as YYYY-MM-DD HH:MM
|
||||
time_str = start_time.strftime("%Y-%m-%d %H:%M") if start_time else "待定"
|
||||
|
||||
# 4. address
|
||||
address = signup.activity.location or "线上活动"
|
||||
|
||||
params = {
|
||||
"user_nick": user_nick or "用户",
|
||||
"unit_name": unit_name,
|
||||
"time": time_str,
|
||||
"address": address
|
||||
}
|
||||
|
||||
print(f"准备发送活动报名成功通知: {order.phone_number}")
|
||||
send_sms(order.phone_number, "SMS_501990528", params)
|
||||
@@ -541,6 +541,14 @@ def payment_finish(request):
|
||||
signup.status = new_status
|
||||
signup.save()
|
||||
print(f"活动报名状态已更新: {signup.id} -> {new_status}")
|
||||
|
||||
# Send Activity SMS
|
||||
try:
|
||||
from .sms_utils import notify_user_activity_signup_success
|
||||
notify_user_activity_signup_success(order, signup)
|
||||
except Exception as sms_e:
|
||||
print(f"发送活动报名短信失败: {str(sms_e)}")
|
||||
|
||||
else:
|
||||
print(f"Error: No ActivitySignup found for paid order {order.id}")
|
||||
|
||||
@@ -644,6 +652,16 @@ def payment_finish(request):
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
# 发送普通商品/课程购买的短信通知(排除活动报名,避免重复发送)
|
||||
# 活动报名的短信已经在上面发送过了
|
||||
if not (hasattr(order, 'activity') and order.activity):
|
||||
try:
|
||||
from .sms_utils import notify_admins_order_paid, notify_user_order_paid
|
||||
notify_admins_order_paid(order)
|
||||
notify_user_order_paid(order)
|
||||
except Exception as e:
|
||||
print(f"发送短信通知失败: {str(e)}")
|
||||
|
||||
except Exception as e:
|
||||
print(f"订单更新失败: {str(e)}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user