docs(database): 新建 docs/database 表文档 — 13 张表全量 + 索引

按"一表一文件"建库表文档(协作规范第 11 条):字段(类型/约束/默认)+
索引与约束 + 关系 + 说明,从 model 的 Mapped 定义扒准。

- README 索引:13 张表总览 + 通用约定(主键/外键/金额分/北京时间日期串/JSONB variant)
- 覆盖 user / coin_account / coin_transaction / cash_transaction / withdraw_order /
  signin_record / user_task / savings_record / ad_reward_record / ad_ecpm_record /
  feedback / comparison_record / comparison_milestone_claim
- savings_record 文档强调"成交省钱"≠"比价行为",与 comparison_record 互不喂数据

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
OuYingJun1024
2026-05-31 20:44:54 +08:00
parent 15dcfa604b
commit bb58fb2a29
14 changed files with 411 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
# feedback — 用户帮助与反馈
> 模型 `app/models/feedback.py` | 关联接口 [feedback](../api/feedback.md) | [← 表索引](./README.md)
每条 = 用户一次反馈提交。`content``contact` 必填,`images` 为可选截图 URL 列表。
## 字段
| 列 | 类型 | 约束 / 默认 | 说明 |
|---|---|---|---|
| `id` | Integer | PK, autoincrement | |
| `user_id` | Integer | FK→user.id, index, NOT NULL | 提交用户 |
| `content` | Text | NOT NULL | 反馈正文 |
| `contact` | String(128) | NOT NULL | 联系方式(微信/QQ/手机,便于回访) |
| `images` | JSON | nullable | 截图 URL 列表(相对路径 `/media/feedback/...`);无图为 NULL |
| `status` | String(16) | NOT NULL, default `new` | `new`(待处理)/ `handled`(已处理) |
| `created_at` | DateTime(tz) | server_default now(), index | 提交时间 |
## 索引与约束
- PK: `id`;index: `user_id``created_at`
## 关系
- `user_id``user.id`(多对一)
## 说明
- `images` 用通用 `JSON`(本表未用 JSONB variant);截图先经 `/media/feedback/` 上传拿到相对路径再随反馈提交。