fff09a3d4d
- ops_stat: 真实值 offset→保底(max);初始基数过只增不减护栏 - ops_marquee: 脱敏名手机尾号+中文昵称混合;金额长尾;时间随机抖动;真实+种子不足兜底补满;真实记录查询 ~30s 缓存 - comparison_record: 复合索引 (status, created_at) + 迁移(PG CONCURRENTLY);修复 alembic 多 head(merge 改挂 onboarding_completion) - 轮播种子批量删除/启用接口 + ids 上限;docs 同步 - 附带并行会话 WIP:admin users / wallet Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
58 lines
1.7 KiB
Python
58 lines
1.7 KiB
Python
"""admin 用户管理 schemas。"""
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
from typing import Literal
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
|
|
class AdminUserListItem(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
phone: str
|
|
nickname: str | None = None
|
|
register_channel: str
|
|
status: str
|
|
debug_trace_enabled: bool = False
|
|
wechat_openid: str | None = None
|
|
created_at: datetime
|
|
last_login_at: datetime
|
|
|
|
|
|
class AdminUserOverview(BaseModel):
|
|
"""用户 360 概览:基础资料 + 钱包余额 + 各项 count(历史明细走各自分页接口)。"""
|
|
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
user: AdminUserListItem
|
|
coin_balance: int
|
|
cash_balance_cents: int
|
|
total_coin_earned: int
|
|
comparison_total: int
|
|
comparison_success: int
|
|
withdraw_total: int
|
|
withdraw_success_cents: int
|
|
feedback_total: int
|
|
|
|
|
|
class GrantCoinsRequest(BaseModel):
|
|
amount: int = Field(..., description="金币变动:正=增加,负=扣减(不可为 0)")
|
|
reason: str = Field(..., min_length=1, max_length=128, description="操作原因(必填,入审计)")
|
|
|
|
|
|
class GrantCashRequest(BaseModel):
|
|
amount_cents: int = Field(..., description="现金变动(分):正=增加,负=扣减(不可为 0)")
|
|
reason: str = Field(..., min_length=1, max_length=128, description="操作原因(必填,入审计)")
|
|
|
|
|
|
class SetUserStatusRequest(BaseModel):
|
|
status: Literal["active", "disabled"] = Field(
|
|
..., description="active=解封 / disabled=封禁(注销 deleted 不走此接口)"
|
|
)
|
|
|
|
|
|
class SetDebugTraceRequest(BaseModel):
|
|
enabled: bool = Field(..., description="是否给该用户开「复制调试链接」权限")
|