4512b6ecac
用户反馈后台:区分反馈类型(比价反馈/普通反馈)+ 审核可给用户留言;提现后台:按提现类型筛选。 - feedback 表加 source(profile/comparison)/scene/admin_reply + 迁移;提交接口 /api/v1/feedback 接收 source/scene,来源判定显式 source 优先、否则据 scene 有无派生(有=comparison); /records 带回 scene + admin_reply。 - admin 反馈:列表加「反馈类型」筛选;采纳/拒绝支持存 admin_reply(给用户的回复,用户端可见); FeedbackOut 带出 source/scene/admin_reply。 - admin 提现:WithdrawOut 暴露 source,列表加「提现类型」筛选(coin_cash=福利页提现 / invite_cash=邀请提现)。 - 补 4 项测试:来源派生、回复存取、反馈按类型筛选、提现按类型筛选。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: zzhyyyyy <2685922758@qq.com> Reviewed-on: #105 Co-authored-by: zhuzihao <zhuzihao@wonderable.ai> Co-committed-by: zhuzihao <zhuzihao@wonderable.ai>
163 lines
4.1 KiB
Python
163 lines
4.1 KiB
Python
"""admin 钱包(金币/现金流水 + 提现单)schemas。"""
|
|
from __future__ import annotations
|
|
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from app.admin.schemas.admin import AdminAuditLogOut
|
|
|
|
|
|
class CoinTxnOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
user_id: int
|
|
amount: int
|
|
balance_after: int
|
|
biz_type: str
|
|
ref_id: str | None = None
|
|
remark: str | None = None
|
|
created_at: datetime
|
|
|
|
|
|
class CashTxnOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
user_id: int
|
|
amount_cents: int
|
|
balance_after_cents: int
|
|
biz_type: str
|
|
ref_id: str | None = None
|
|
remark: str | None = None
|
|
created_at: datetime
|
|
|
|
|
|
class WithdrawOrderOut(BaseModel):
|
|
model_config = ConfigDict(from_attributes=True)
|
|
|
|
id: int
|
|
user_id: int
|
|
out_bill_no: str
|
|
amount_cents: int
|
|
# 提现类型:coin_cash(福利页提现,金币兑换的现金)/ invite_cash(邀请提现,邀请奖励金)
|
|
source: str = "coin_cash"
|
|
user_name: str | None = None # 提现实名(审核核对 + 打款用)
|
|
status: str
|
|
wechat_state: str | None = None
|
|
transfer_bill_no: str | None = None
|
|
fail_reason: str | None = None
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
|
|
class WithdrawListItemOut(WithdrawOrderOut):
|
|
"""提现单列表项:在提现单字段基础上,补本页用户的手机号/昵称 + 累计成功提现金额(分)。
|
|
|
|
仅列表接口用(需联表 User + 聚合);详情/批量仍用 WithdrawOrderOut(不带这些字段)。
|
|
"""
|
|
|
|
phone: str | None = None
|
|
nickname: str | None = None
|
|
cumulative_success_cents: int = 0 # 累计成功提现 = SUM(amount_cents) WHERE status='success'
|
|
|
|
|
|
class WithdrawSummaryOut(BaseModel):
|
|
reviewing_count: int
|
|
reviewing_amount_cents: int
|
|
pending_count: int
|
|
failed_count: int
|
|
today_success_count: int
|
|
today_success_amount_cents: int
|
|
today_rejected_count: int
|
|
|
|
|
|
class WithdrawUserSnapshot(BaseModel):
|
|
id: int
|
|
phone: str
|
|
nickname: str | None = None
|
|
status: str
|
|
wechat_nickname: str | None = None
|
|
wechat_avatar_url: str | None = None
|
|
created_at: datetime
|
|
last_login_at: datetime
|
|
cash_balance_cents: int
|
|
withdraw_total: int
|
|
withdraw_success_cents: int
|
|
|
|
|
|
class WithdrawDetailOut(BaseModel):
|
|
order: WithdrawOrderOut
|
|
user: WithdrawUserSnapshot | None = None
|
|
risk_flags: list[str]
|
|
risk_score: int
|
|
recent_withdraws: list[WithdrawOrderOut]
|
|
recent_cash_transactions: list[CashTxnOut]
|
|
audit_logs: list[AdminAuditLogOut]
|
|
|
|
|
|
class ReconcileResult(BaseModel):
|
|
checked: int
|
|
resolved: int
|
|
|
|
|
|
class WithdrawBulkRequest(BaseModel):
|
|
out_bill_nos: list[str] = Field(
|
|
..., min_length=1, max_length=50, description="提现商户单号列表"
|
|
)
|
|
|
|
|
|
class WithdrawBulkRejectRequest(WithdrawBulkRequest):
|
|
reason: str = Field(
|
|
..., min_length=1, max_length=200, description="批量拒绝理由(用户可见)"
|
|
)
|
|
|
|
|
|
class WithdrawBulkItemResult(BaseModel):
|
|
out_bill_no: str
|
|
ok: bool
|
|
status: str | None = None
|
|
error: str | None = None
|
|
|
|
|
|
class WithdrawBulkResult(BaseModel):
|
|
total: int
|
|
success: int
|
|
failed: int
|
|
items: list[WithdrawBulkItemResult]
|
|
|
|
|
|
class WithdrawLedgerCheckOut(BaseModel):
|
|
ok: bool
|
|
cash_balance_total_cents: int
|
|
cash_transaction_total_cents: int
|
|
balance_diff_cents: int
|
|
missing_withdraw_txn_count: int
|
|
missing_refund_txn_count: int
|
|
duplicate_refund_txn_count: int
|
|
refund_txn_on_non_terminal_count: int
|
|
|
|
|
|
class WxpayHealthCheckOut(BaseModel):
|
|
ok: bool
|
|
wxpay_configured: bool
|
|
wxpay_auth_configured: bool
|
|
private_key_path: str
|
|
private_key_exists: bool
|
|
private_key_loadable: bool
|
|
public_key_path: str
|
|
public_key_exists: bool
|
|
public_key_loadable: bool
|
|
auth_notify_url_configured: bool
|
|
auto_reconcile_enabled: bool
|
|
auto_reconcile_interval_sec: int
|
|
auto_reconcile_older_than_minutes: int
|
|
issues: list[str]
|
|
|
|
|
|
class WithdrawRejectRequest(BaseModel):
|
|
reason: str = Field(
|
|
..., min_length=1, max_length=200, description="拒绝理由(写入 fail_reason,用户可见)"
|
|
)
|