feat: coupon/step 透传去鉴权(MVP) + 技术债账本补充领券落地遗留

- /api/v1/coupon/step 去掉 CurrentUser 鉴权:MVP 领券不鉴权,device_id 透传给
  pricebot 区分设备;user_id 绑定 + 用户级画像见账本 P1,待补
- docs/待办与技术债.md 补「阶段1领券落地遗留」:FloatingButton 死代码、ComparingScreen
  弃用、ApiClient unused 常量、权限引导最简版等待清理项

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-27 16:38:10 +08:00
parent a188c43bf7
commit 007f8a0eb2
2 changed files with 14 additions and 6 deletions
+6 -6
View File
@@ -1,7 +1,9 @@
"""领券业务透传端点。
把客户端的 POST /api/v1/coupon/step 请求原样转发给 pricebot-backend
的 /api/coupon/step,只在外层加 JWT 鉴权。
的 /api/coupon/step。MVP 阶段**不鉴权**(见 docs/待办与技术债.md P1:
device_id 透传给 pricebot 区分设备,待补 JWT + device_id↔user_id 绑定后
才能做用户级画像)。
pricebot 协议文档:
pricebot-backend/docs/projects/领券-客户端对接协议.md
@@ -14,7 +16,6 @@ from typing import Any
import httpx
from fastapi import APIRouter, HTTPException, Request, status
from app.api.deps import CurrentUser
from app.core.config import settings
logger = logging.getLogger("shagua.coupon")
@@ -25,11 +26,10 @@ router = APIRouter(prefix="/api/v1/coupon", tags=["coupon"])
@router.post("/step", summary="领券任务步进 (透传到 pricebot)")
async def coupon_step(
request: Request,
user: CurrentUser,
) -> dict[str, Any]:
"""把请求体原样转发给 pricebot-backend 的 /api/coupon/step。
- 鉴权: Bearer access_token (get_current_user 隐式校验)
- 鉴权: MVP 阶段不鉴权(待补 JWT,见 docs/待办与技术债.md P1)
- 透传: 不做 schema 校验,pricebot 自己校验
- 失败: 网络不可达 / pricebot 5xx → 502 + 友好 message
"""
@@ -42,8 +42,8 @@ async def coupon_step(
timeout = settings.PRICEBOT_REQUEST_TIMEOUT_SEC
logger.info(
"coupon_step user_id=%d trace_id=%s step=%s",
user.id,
"coupon_step device_id=%s trace_id=%s step=%s",
body.get("device_id"),
body.get("trace_id"),
body.get("step"),
)