docs(admin): 补充管理后台 API 与数据库文档 (#12)
新增 admin 模块接口文档(auth login/me、admins CRUD、audit-logs、feedback 处理、stats 概览、user coins/detail/status、wallet 流水、withdraw 对账/刷新/列表) + admin_user/admin_audit_log 两张表文档,更新 api/database README 索引。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: OuYingJun1024 <1034284404@qq.com> Reviewed-on: #12 Co-authored-by: ouzhou <ouzhou@wonderable.ai> Co-committed-by: ouzhou <ouzhou@wonderable.ai>
This commit was merged in pull request #12.
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
# GET /admin/api/stats/overview — 大盘核心指标
|
||||
|
||||
> 所属:Admin·数据大盘 组(前缀 `/admin/api/stats`) | 鉴权:Bearer admin_token(角色:任意已登录管理员,无 require_role) | [← 返回 API 索引](./README.md)
|
||||
|
||||
## 入参
|
||||
无
|
||||
|
||||
## 出参
|
||||
响应 `200`:`DashboardOverview`(全局只读聚合,六大块嵌套)
|
||||
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `users` | DashboardUsers | 用户指标 |
|
||||
| `coins` | DashboardCoins | 金币指标 |
|
||||
| `cash` | DashboardCash | 现金/提现指标 |
|
||||
| `comparison` | DashboardComparison | 比价指标 |
|
||||
| `feedback` | DashboardFeedback | 反馈指标 |
|
||||
| `cps` | DashboardCps | CPS 收入(P2 未接入) |
|
||||
|
||||
**DashboardUsers**
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `total` | int | 用户总数 |
|
||||
| `active` | int | 状态 `active` 数 |
|
||||
| `disabled` | int | 状态 `disabled` 数 |
|
||||
| `deleted` | int | 状态 `deleted` 数 |
|
||||
| `new_today` | int | 今日新增(按北京时区切天的 `created_at`) |
|
||||
| `dau` | int | 日活(今日有 `last_login_at`,北京时区切天) |
|
||||
|
||||
**DashboardCoins**
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `granted_total` | int | 累计发放金币(coin_transaction 中所有 `amount > 0` 之和;负数兑换/扣减不计) |
|
||||
|
||||
**DashboardCash**
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `withdraw_success_cents` | int | 提现成功累计金额(分,`status=success` 之和) |
|
||||
| `withdraw_pending_count` | int | 提现 `pending` 单数 |
|
||||
| `withdraw_success_count` | int | 提现 `success` 单数 |
|
||||
| `withdraw_failed_count` | int | 提现 `failed` 单数 |
|
||||
|
||||
**DashboardComparison**
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `total` | int | 比价记录总数 |
|
||||
| `success` | int | 比价成功数(`status=success`) |
|
||||
| `success_rate` | float | 成功率 = success/total,保留 4 位小数;total 为 0 时返回 `0.0` |
|
||||
|
||||
**DashboardFeedback**
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `new` | int | 待处理反馈数(`status=new`) |
|
||||
|
||||
**DashboardCps**
|
||||
| 字段 | 类型 | 说明 |
|
||||
|---|---|---|
|
||||
| `available` | bool | CPS 数据是否可用(当前固定 `false`) |
|
||||
| `note` | string | 说明文案(当前固定 `"CPS 转化数据未接入(P2)"`) |
|
||||
|
||||
## 错误码
|
||||
- `401` 未带/无效/过期 admin token、管理员被禁用(头带 `WWW-Authenticate: Bearer`)
|
||||
|
||||
## 说明
|
||||
- 全部为全局只读聚合(count / sum / DAU / 成功率),不改任何数据。
|
||||
- `new_today` / `dau` 按**北京时区**(UTC+8)切天,其余金额/计数无时区概念。
|
||||
- 金额单位:`*_cents` 为分;金币(`granted_total`)为个数。
|
||||
- CPS 收入数据源未接入(referral-link 只换链接,转化/佣金未回收),`cps` 恒为 `{available:false, note:...}`,前端显示"待接入"。
|
||||
- 关联表:[user](../database/user.md) / [coin_transaction](../database/coin_transaction.md) / [withdraw_order](../database/withdraw_order.md) / [comparison_record](../database/comparison_record.md) / [feedback](../database/feedback.md)。
|
||||
Reference in New Issue
Block a user