de1fd58749
要守住的不变量:弹窗数字 == 本轮实际到账之和 == 用户看到的余额涨幅。三者对不上, 用户就会认为少发了钱(走查现象:弹窗 240、余额只涨 40)。 - reward-result:按 ad_session_id 查本次实发金币,替代余额差 / coin_per_ad 估算。 S2S 异步未到账返 200+pending 而非 404(404 只表示路由不存在,混在一起客户端没法 区分「后端没部署」和「再等等」);同 session 多条时显式优先 granted——客户端先报 closed_early、S2S 后到时,granted 反而是后写的。 - boost_round_id:客户端经 mediaExtra 透传「这条广告属于哪一轮膨胀」,穿山甲 S2S 原样 带回后随发奖记录落库。**纯标签,不参与发奖判定**。reward-result 新增 round_coin,按 (user_id, boost_round_id) 对 granted 记录求和。之所以由服务端求和而非客户端自己累加 ——客户端进程被杀/重建后本地累计会丢,发奖记录不会。 · 求和恒带 user_id:轮 id 是客户端生成的,不带就等于让任何人拿别人的轮 id 查别人发了多少。 · 本条非 granted(capped 等)时仍返本轮累计、该条按 0 计,让限额 toast 有数可显。 · test-grant 加可选 boost_round_id:它不经 S2S 拿不到 extra,不补则 debug 包验不了累计。 · 客户端复用同一轮 id 只会把展示数字滚大,求和的是已发生的记录,不产生新入账,无资损。 - 下线 signin_boost(签到膨胀):它按固定 3000 金币发、与广告实际收益脱钩,产品确认从来 不是设计内的口径——奖励只有「签到」和「看视频」两种。签到弹窗的「看广告膨胀」改与福利页 看视频同走 reward_video(按 eCPM 公式)。摘除回调分支、POST /signin/boost、 SigninBoostRecord、signin_boost_coin 配置,并 drop signin_boost_record 表。 **coin_transaction.biz_type='signin_boost' 的历史流水保留不动**——钱是真发过的,账必须 留得住;admin 大盘那两项改从金币流水统计(一次膨胀 = 一笔,与原口径等价),继续能查回历史。 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
78 lines
3.9 KiB
Markdown
78 lines
3.9 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 | **历史口径**:签到膨胀次数。膨胀 2026-07 已下线、`signin_boost_record` 表已 drop,改数 `coin_transaction.biz_type='signin_boost'` 的入账笔数(一次膨胀 = 一笔,与原口径等价),只会停在历史值不再增长 |
|
||
|
||
**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)。
|