Add user profile management for smoking data

- Introduced new API endpoints `GET /api/v1/smoke/profile` and `PUT /api/v1/smoke/profile` for retrieving and updating user smoking profiles.
- Added a new database table `fa_smoke_user_profile` to store user-specific smoking data, including daily smoking habits and motivations.
- Updated the smoke handler and service to integrate user profile data into AI advice generation.
- Enhanced documentation to reflect the new user profile features and their usage.
This commit is contained in:
nepiedg
2026-01-20 02:37:20 +00:00
parent 0b26ba6d35
commit dc54c4e934
11 changed files with 703 additions and 5 deletions
+10
View File
@@ -15,6 +15,16 @@
- 该表使用旧系统字段:`createtime/updatetime/deletetime`(秒级时间戳),并非 GORM 默认的 `created_at/updated_at/deleted_at`
- 接口层通过 Token 识别用户,`uid` 由后端从登录用户推导,不允许前端传入。
### 用户基础信息(首次进入补全)
用于建立“初始基准/个性化策略”的用户信息表:
- `fa_smoke_user_profile`DDL 见:`docs/sql/smoke.sql`
典型字段:
- 日均抽烟支数、烟龄、单包价格
- 抽烟动机、戒烟动力
- 起床/入睡时间(用于规避睡眠时间)
### 真实抽烟时间(推荐使用 `smoke_at`
为支持“按时间节点分析”(例如:昨天哪些时段更容易想抽),建议在 `fa_smoke_log` 中新增: