From 72918c3b8d07c7075b4e8641982cf9038582621f Mon Sep 17 00:00:00 2001 From: wtz Date: Sun, 22 Feb 2026 23:11:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=8E=A9=E5=AE=B6=E5=87=BA=E7=89=8C/?= =?UTF-8?q?=E8=BF=87=E7=89=8C=E6=97=B6=E5=88=B7=E6=96=B0UserRoomKey=20TTL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/internal/game/game.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/internal/game/game.go b/app/internal/game/game.go index 328cc1d..2e0f523 100644 --- a/app/internal/game/game.go +++ b/app/internal/game/game.go @@ -646,6 +646,10 @@ func (gm *GameManager) PlayCards(roomID, playerID string, cards []models.Card) e } gm.saveRoom(ctx, room) + // 刷新用户-房间关联的TTL + if player.UserID != "" { + gm.rdb.Set(ctx, redis.UserRoomKey(player.UserID), roomID, redis.RoomTTL) + } return nil } @@ -686,6 +690,13 @@ func (gm *GameManager) Pass(roomID, playerID string) error { } gm.saveRoom(ctx, room) + // 刷新用户-房间关联的TTL + for _, p := range room.Players { + if p.ID == playerID && p.UserID != "" { + gm.rdb.Set(ctx, redis.UserRoomKey(p.UserID), roomID, redis.RoomTTL) + break + } + } return nil }