feat(points): 新增今日消耗接口 + 个人中心字体调整
后端: - CRUD 新增 sum_consumed_today() 方法,统计用户今日消费积分总和 - API 新增 GET /points/today-consumed 路由 前端: - 个人中心积分数字从 40px 改为 32px - 今日消耗从本地计算改为调用后端接口
This commit is contained in:
@@ -497,6 +497,18 @@ async def get_points_rules(
|
||||
|
||||
|
||||
|
||||
# ── 今日消费统计 ──────────────────────────────────────
|
||||
|
||||
@router.get("/today-consumed", response_model=ApiResponse[dict])
|
||||
async def get_today_consumed(
|
||||
db: AsyncSession = Depends(get_db),
|
||||
current_user: User = Depends(get_current_user),
|
||||
):
|
||||
"""获取当前用户今日消费积分总额"""
|
||||
total = await point_transaction.sum_consumed_today(db, user_id=current_user.id)
|
||||
return success_response(data={"total": total})
|
||||
|
||||
|
||||
# ── 直接消费扣费(前端/Rust 层调用)───────────────────
|
||||
|
||||
@router.post("/consume", response_model=ApiResponse[dict])
|
||||
|
||||
Reference in New Issue
Block a user