90c0d65a16
Co-authored-by: OuYingJun1024 <1034284404@qq.com> Reviewed-on: #11 Co-authored-by: ouzhou <ouzhou@wonderable.ai> Co-committed-by: ouzhou <ouzhou@wonderable.ai>
27 lines
1.5 KiB
Markdown
27 lines
1.5 KiB
Markdown
# comparison_milestone_claim — 比价战绩里程碑领取记录
|
|
|
|
> 模型 `app/models/comparison_milestone.py` | 关联接口 [compare-milestones](../api/compare-milestones.md) / [compare-milestone-claim](../api/compare-milestone-claim.md) | [← 表索引](./README.md)
|
|
|
|
「记录比价战绩」每档(第 1~6 次)只能领一次,领取后写一行;解锁进度由 `comparison_record` 里 `status='success'` 的条数决定,本表只记"哪几档已领"。仿 `user_task` 的一次性领取模型。
|
|
|
|
## 字段
|
|
| 列 | 类型 | 约束 / 默认 | 说明 |
|
|
|---|---|---|---|
|
|
| `id` | Integer | PK, autoincrement | |
|
|
| `user_id` | Integer | FK→user.id, index, NOT NULL | 归属用户 |
|
|
| `milestone` | Integer | NOT NULL | 档位序号(1-based),见 `rewards.RECORD_MILESTONES` |
|
|
| `coin_awarded` | Integer | NOT NULL, default 0 | 该档应发金币额;⚠️ 当前产品定暂不真发,实际恒为 0 |
|
|
| `claimed_at` | DateTime(tz) | server_default now() | 领取时间 |
|
|
|
|
## 索引与约束
|
|
- PK: `id`;index: `user_id`
|
|
- UNIQUE(`user_id`, `milestone`) = `uq_compare_milestone_user`(防同档重复领)
|
|
|
|
## 关系
|
|
- `user_id` → `user.id`(多对一)
|
|
- 解锁进度依赖 `comparison_record`(`status='success'` 计数),本表不存进度本身。
|
|
|
|
## 说明
|
|
- ⚠️ 当前 claim 仅写本表标记已领(去重),**不调 `grant_coins`、不写 `coin_transaction`,`coin_awarded` 恒为 0、余额不变**(产品定暂不真发金币,后续整体删除该功能)。
|
|
- 领取校验:档位越界 404、未解锁(成功数 < milestone)409、已领 409。
|