From 2bbe82fd231b8cff76680978b3507035c2f7058e Mon Sep 17 00:00:00 2001 From: yumoqing Date: Mon, 6 Jul 2026 14:41:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=94=A8dspy=E5=8E=9F=E7=94=9Fbare=20fu?= =?UTF-8?q?nction(get=5Fuser/entire=5Furl/bind=5Fcustomer)=EF=BC=8C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89env=E9=97=B4=E6=8E=A5=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- wwwroot/promote/index.dspy | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/wwwroot/promote/index.dspy b/wwwroot/promote/index.dspy index 2e369dc..62f0b9c 100644 --- a/wwwroot/promote/index.dspy +++ b/wwwroot/promote/index.dspy @@ -2,19 +2,18 @@ # 参数: code=促销码id 或 id=discount_qr id # 已登录: 直接绑定; 未登录: 提示登录/注册 -env = request._run_ns code = params_kw.get('code', '') qr_id = params_kw.get('id', '') -user = await env.get_user() +user = await get_user() if not user: # 未登录 - 显示登录/注册引导 back_url = '' if code: - back_url = env.entire_url('./promote/index.dspy') + f'?code={code}' + back_url = entire_url('./promote/index.dspy') + f'?code={code}' elif qr_id: - back_url = env.entire_url('./promote/index.dspy') + f'?id={qr_id}' + back_url = entire_url('./promote/index.dspy') + f'?id={qr_id}' result = { "widgettype": "VBox", @@ -38,7 +37,7 @@ if not user: "label": "登录", "css": "primary", "actiontype": "link", - "url": env.entire_url('/rbac/user/login.ui') + f"?back={back_url}" if back_url else env.entire_url('/rbac/user/login.ui') + "url": entire_url('/rbac/user/login.ui') + f"?back={back_url}" if back_url else entire_url('/rbac/user/login.ui') } }, { @@ -47,7 +46,7 @@ if not user: "label": "注册", "css": "secondary", "actiontype": "link", - "url": env.entire_url('/rbac/user/register') + f"?back={back_url}" if back_url else env.entire_url('/rbac/user/register') + "url": entire_url('/rbac/user/register') + f"?back={back_url}" if back_url else entire_url('/rbac/user/register') } } ] @@ -57,11 +56,10 @@ if not user: elif code: # 已登录 + 促销码参数 - 绑定促销码 try: - # bind_customer expects promo_code_id bind_params = params_kw.copy() bind_params['promo_code_id'] = code ret = await bind_customer(request, bind_params) - home_url = env.entire_url('/') + home_url = entire_url('/') if ret.get('status') == 'success': result = { "widgettype": "VBox",