da7ce69494
- 新增 POST /api/v1/ad/ecpm-report:激励视频展示后客户端上报本次 eCPM,落 ad_ecpm_record 做内部收益统计(model/repository/schema/alembic 迁移 + 接口文档) - 看广告冷却策略抽到 app/core/ad_cooldown.py 纯函数;ad_reward.today_status 只取数据,换策略只改这一处 - savings.dishes 改 JSON().with_variant(JSONB,"postgresql"):SQLite 无 visit_JSONB 会让 create_all 编译崩,修复后测试套件恢复 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: OuYingJun1024 <1034284404@qq.com> Reviewed-on: #8 Co-authored-by: ouzhou <ouzhou@wonderable.ai> Co-committed-by: ouzhou <ouzhou@wonderable.ai>
27 lines
1.2 KiB
Markdown
27 lines
1.2 KiB
Markdown
# cash_transaction — 现金流水账本(分)
|
|
|
|
> 模型 `app/models/wallet.py` | 关联接口 [wallet-cash-transactions](../api/wallet-cash-transactions.md) | [← 表索引](./README.md)
|
|
|
|
现金每次变动一笔流水(单位:分)。金币兑现金、提现、提现退款都记这里。
|
|
|
|
## 字段
|
|
| 列 | 类型 | 约束 / 默认 | 说明 |
|
|
|---|---|---|---|
|
|
| `id` | Integer | PK, autoincrement | |
|
|
| `user_id` | Integer | FK→user.id, index, NOT NULL | 归属用户 |
|
|
| `amount_cents` | Integer | NOT NULL | 正=入账(兑入),负=出账(提现) |
|
|
| `balance_after_cents` | Integer | NOT NULL | 本笔变动后现金余额(分) |
|
|
| `biz_type` | String(32) | NOT NULL | `exchange_in`(兑入)/ `withdraw`(提现出账)/ `withdraw_refund`(提现退回) |
|
|
| `ref_id` | String(64) | nullable | 关联业务 id(如提现 `out_bill_no`) |
|
|
| `remark` | String(128) | nullable | 用户可见备注(如"提现未成功,金额已退回") |
|
|
| `created_at` | DateTime(tz) | server_default now(), index | 时间 |
|
|
|
|
## 索引与约束
|
|
- PK: `id`;index: `user_id`、`created_at`
|
|
|
|
## 关系
|
|
- `user_id` → `user.id`(多对一)
|
|
|
|
## 说明
|
|
- 提现失败/取消退款写 `withdraw_refund`(+X);退款流水 `remark` 是用户可见文案,技术原因记在 `withdraw_order.fail_reason`。
|