fix: from discount.init import bind_customer, 绕过dspy bare function 查找失败

This commit is contained in:
yumoqing 2026-07-06 14:55:32 +08:00
parent 9a8d7f10aa
commit 34a2fecc99

View File

@ -2,13 +2,14 @@
# 参数: code=促销码id 或 id=discount_qr id
# 已登录: 直接绑定; 未登录: 提示登录/注册
from discount.init import bind_customer, set_promote_discount
code = params_kw.get('code', '')
qr_id = params_kw.get('id', '')
user = await get_user()
if not user:
# 未登录 - 显示登录/注册引导
back_url = ''
if code:
back_url = entire_url('./promote/index.dspy') + f'?code={code}'
@ -54,7 +55,6 @@ if not user:
]
}
elif code:
# 已登录 + 促销码参数 - 绑定促销码
try:
bind_params = params_kw.copy()
bind_params['promo_code_id'] = code
@ -95,7 +95,6 @@ elif code:
"options": {"title": "激活失败", "message": str(e), "type": "error"}
}
else:
# 已登录 + 折扣二维码参数 - 走旧流程
ret = await set_promote_discount(request, params_kw)
result = {
"widgettype": "Message",