feat: 两级匹配机制 - 全票通过即时匹配 + 滑完自动推荐得票最高

- 后端 GET /api/room/[id] 新增 findBestMatch,滑完后选出得票最高餐厅
- 平票时取高德评分更高的一家,永远不会出现"无结果"死局
- 返回 matchType (unanimous/best) 和 matchLikes 区分匹配类型
- 全票通过:绿色庆祝 + "大家一拍即合!"
- 得票最高:橙色推荐 + "N/M 人想去这家"
- 移除 noMatch 死局页面,简化 SwipeDeck 状态管理
This commit is contained in:
2026-02-24 17:26:16 +08:00
parent bdab39d866
commit e2c3b869eb
6 changed files with 116 additions and 52 deletions
+3 -2
View File
@@ -18,7 +18,7 @@ export function useRoomPolling(roomId: string) {
},
);
if (data?.match != null || data?.noMatch) {
if (data?.match != null) {
settled.current = true;
} else {
settled.current = false;
@@ -27,7 +27,8 @@ export function useRoomPolling(roomId: string) {
return {
userCount: data?.userCount ?? 0,
match: data?.match ?? null,
noMatch: data?.noMatch ?? false,
matchType: data?.matchType ?? null,
matchLikes: data?.matchLikes ?? 0,
restaurants: data?.restaurants ?? [],
isLoading,
error,