fix: from discount.init import bind_customer, 绕过dspy bare function 查找失败
This commit is contained in:
parent
9a8d7f10aa
commit
34a2fecc99
@ -2,13 +2,14 @@
|
|||||||
# 参数: code=促销码id 或 id=discount_qr id
|
# 参数: code=促销码id 或 id=discount_qr id
|
||||||
# 已登录: 直接绑定; 未登录: 提示登录/注册
|
# 已登录: 直接绑定; 未登录: 提示登录/注册
|
||||||
|
|
||||||
|
from discount.init import bind_customer, set_promote_discount
|
||||||
|
|
||||||
code = params_kw.get('code', '')
|
code = params_kw.get('code', '')
|
||||||
qr_id = params_kw.get('id', '')
|
qr_id = params_kw.get('id', '')
|
||||||
|
|
||||||
user = await get_user()
|
user = await get_user()
|
||||||
|
|
||||||
if not user:
|
if not user:
|
||||||
# 未登录 - 显示登录/注册引导
|
|
||||||
back_url = ''
|
back_url = ''
|
||||||
if code:
|
if code:
|
||||||
back_url = entire_url('./promote/index.dspy') + f'?code={code}'
|
back_url = entire_url('./promote/index.dspy') + f'?code={code}'
|
||||||
@ -54,7 +55,6 @@ if not user:
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
elif code:
|
elif code:
|
||||||
# 已登录 + 促销码参数 - 绑定促销码
|
|
||||||
try:
|
try:
|
||||||
bind_params = params_kw.copy()
|
bind_params = params_kw.copy()
|
||||||
bind_params['promo_code_id'] = code
|
bind_params['promo_code_id'] = code
|
||||||
@ -95,7 +95,6 @@ elif code:
|
|||||||
"options": {"title": "激活失败", "message": str(e), "type": "error"}
|
"options": {"title": "激活失败", "message": str(e), "type": "error"}
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
# 已登录 + 折扣二维码参数 - 走旧流程
|
|
||||||
ret = await set_promote_discount(request, params_kw)
|
ret = await set_promote_discount(request, params_kw)
|
||||||
result = {
|
result = {
|
||||||
"widgettype": "Message",
|
"widgettype": "Message",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user