d7c29c0883
- rewards: 激励视频实发改按 calculate_ad_reward_coin(eCPM, 当日第N次) 公式;AD_REWARD_COIN/MAX_AD_REWARD_COIN 降为历史兼容口径;新增 SIGNIN_BOOST_COIN=2000 - 签到膨胀: Day1-13 看完激励视频额外发固定金币、Day14 不允许 (signin.py / signin-boost) - ad_session_id 幂等: ad_ecpm/ad_reward/ad_feed_reward 记录加 ad_session_id 列 + 唯一索引(新迁移 coin_reward_phase2 / ad_feed_reward_session) - ad.py + schemas + repositories: ecpm-report / feed-reward / reward-status / test-grant 改造;config_schema 增 signin_boost_coin;admin stats overview 补充 - 同步 docs/api + docs/database + docs/integrations/pangle 及 tests(test_ad_reward / test_welfare) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: OuYingJun1024 <1034284404@qq.com> Reviewed-on: #28 Co-authored-by: ouzhou <ouzhou@wonderable.ai> Co-committed-by: ouzhou <ouzhou@wonderable.ai>
78 lines
3.6 KiB
Markdown
78 lines
3.6 KiB
Markdown
# 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` 之和;负数兑换/扣减不计) |
|
||
| `reward_video_coin_total` | int | 普通激励视频累计发放金币(`biz_type=reward_video/ad_reward`) |
|
||
| `reward_video_watch_count` | int | 普通激励视频有效发奖视频数(`ad_reward_record.reward_scene=reward_video,status=granted`) |
|
||
| `feed_ad_coin_total` | int | 信息流广告累计发放金币(`biz_type=feed_ad_reward`) |
|
||
| `feed_ad_watch_count` | int | 信息流广告有效完成视频数(`ad_feed_reward_record.status=granted`) |
|
||
| `signin_coin_total` | int | 签到累计发放金币(`biz_type=signin`) |
|
||
| `signin_count` | int | 签到次数(`signin_record`) |
|
||
| `signin_boost_coin_total` | int | 签到膨胀累计发放金币(`biz_type=signin_boost`) |
|
||
| `signin_boost_watch_count` | int | 签到膨胀有效视频数(`signin_boost_record`) |
|
||
|
||
**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` 为分;金币(`*_coin_total`/`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)。
|