2.3 KiB
2.3 KiB
Phase 08 Completion Report
Status
✅ Completed
Implemented
P08-T01 ~ P08-T12: 关系核心
UserRelation实体 +UserRelationMapper(like/pass/block 查询)Match实体 +MatchMapper(active match查找、列表)RelationshipSuccessRequest实体 + MapperRelationshipService— Like/Pass/Block/Unblock/Unmatch/ConfirmSuccessMatchDTO/FateItemDTODTORelationshipController— 11个API端点- V007 迁移:user_relations + matches + relationship_success_requests
核心Invariants已保护
- Block优先级最高:Block后立即停止聊天/推荐/搜索
- 双向Match唯一性:标准化user_a/user_b + 唯一索引
- 未Mutual不可聊天(由Phase 09 Conversation创建保证)
- 取消喜欢仅Mutual前允许
Miniapp 页面
- U22 我的缘分页 — 三Tab(互相喜欢/我喜欢的/喜欢我的)
- 喜欢回应用户 — 确认后触发双向Match
Database Changes
- V007: +3 张表(user_relations, matches, relationship_success_requests)
- 唯一约束:uk_user_relation(user_id, target_user_id, relation_type)
- 唯一约束:uk_match_pair(user_a_id, user_b_id)
API Changes
新增接口:
| Method | Path | 描述 |
|---|---|---|
| POST | /relations/{id}/like | 表达喜欢 |
| DELETE | /relations/{id}/like | 取消喜欢 |
| POST | /relations/{id}/pass | 表示不合适 |
| POST | /relations/{id}/block | 拉黑 |
| DELETE | /relations/{id}/block | 解除拉黑 |
| GET | /relations/matches | 我的匹配列表 |
| POST | /relations/matches/{id}/unmatch | 解除匹配 |
| GET | /relations/fate/mutual | 互相喜欢列表 |
| GET | /relations/fate/liked | 我喜欢的 |
| GET | /relations/fate/likers | 喜欢我的 |
| POST | /relations/success/request | 发起成功牵手 |
| POST | /relations/success/confirm | 确认成功牵手 |
Tests
RelationshipServiceTest: 3 个用例(常量验证)RecommendationEngineServiceMockTest: 2 个用例
Security Review
- Block后自动取消Like关系
- Block后自动解除Match
- 所有关系操作需认证
- 审计日志记录Like/Block操作
Known Issues
- ConfirmSuccess 需要双确认逻辑(Phase 12 完善)
- Conversation 创建在 Phase 09 实现
Next Phase
Phase 09: 文字聊天(Conversation + Messages + REST发送 + WebSocket接收)