refactor(utils): 修复密码哈希比较逻辑错误 feat(user): 新增按状态筛选优惠券接口 docs: 添加虚拟发货与任务中心相关文档 fix(wechat): 修正Code2Session上下文传递问题 test: 补充订单折扣与积分转换测试用例 build: 更新配置文件与构建脚本 style: 清理多余的空行与注释
62 lines
1.7 KiB
Markdown
62 lines
1.7 KiB
Markdown
# 数据模型文档:任务中心
|
||
|
||
## Tasks
|
||
- id BIGINT PK
|
||
- name VARCHAR(64)
|
||
- description TEXT
|
||
- status TINYINT(0禁用,1启用)
|
||
- start_time DATETIME
|
||
- end_time DATETIME
|
||
- visibility TINYINT(0隐藏,1展示)
|
||
- conditions_schema JSON(可选)
|
||
- created_at DATETIME
|
||
- updated_at DATETIME
|
||
|
||
## TaskTiers
|
||
- id BIGINT PK
|
||
- task_id BIGINT FK→Tasks.id
|
||
- metric ENUM(`first_order`/`order_count`/`invite_count`)
|
||
- operator ENUM(`>=`/`==`)
|
||
- threshold INT或JSON数组(阶梯)
|
||
- window ENUM(`activity_period`/`since_registration`)
|
||
- repeatable TINYINT(0否,1每档一次)
|
||
- priority INT(匹配优先级)
|
||
- created_at DATETIME
|
||
- updated_at DATETIME
|
||
|
||
## TaskRewards
|
||
- id BIGINT PK
|
||
- task_id BIGINT FK→Tasks.id
|
||
- tier_id BIGINT FK→TaskTiers.id
|
||
- reward_type ENUM(`points`/`coupon`/`item_card`/`title`)
|
||
- reward_payload JSON(如:积分数、券ID、卡ID、称号ID)
|
||
- quantity INT(库存/发放上限,可选)
|
||
- created_at DATETIME
|
||
- updated_at DATETIME
|
||
|
||
## UserTaskProgress
|
||
- id BIGINT PK
|
||
- user_id BIGINT
|
||
- task_id BIGINT
|
||
- metrics JSON(`order_count`、`invite_count`、`first_order`)
|
||
- claimed_tiers JSON数组(已领取档位ID)
|
||
- updated_at DATETIME
|
||
- created_at DATETIME
|
||
|
||
## TaskEventLogs
|
||
- id BIGINT PK
|
||
- event_id VARCHAR(64)
|
||
- source_type ENUM(`order`/`invite`)
|
||
- source_id BIGINT
|
||
- user_id BIGINT
|
||
- task_id BIGINT
|
||
- tier_id BIGINT
|
||
- idempotency_key VARCHAR(128)
|
||
- status ENUM(`granted`/`skipped`/`rejected`)
|
||
- result JSON(错误/风控原因或发奖明细)
|
||
- created_at DATETIME
|
||
|
||
## UserTitles(如复用现表则略)
|
||
- 复用`internal/repository/mysql/model/user_titles.gen.go`,如需从任务中心发放,记录来源`source_task_id/tier_id`
|
||
|