|
|
|
@ -738,6 +738,7 @@ func AddGameRecord(uid int, provider int, gameId int) error { |
|
|
|
member := fmt.Sprintf("%v_%v", provider, gameId) |
|
|
|
member := fmt.Sprintf("%v_%v", provider, gameId) |
|
|
|
playerGamesSetKey := fmt.Sprintf("player:%v:games:set", uid) |
|
|
|
playerGamesSetKey := fmt.Sprintf("player:%v:games:set", uid) |
|
|
|
playerGamesListKey := fmt.Sprintf("player:%v:games:list", uid) |
|
|
|
playerGamesListKey := fmt.Sprintf("player:%v:games:list", uid) |
|
|
|
|
|
|
|
playerGamesAt := fmt.Sprintf("player:%v:games:at", uid) |
|
|
|
ctx := context.Background() |
|
|
|
ctx := context.Background() |
|
|
|
client := db.Redis().GetRedis() |
|
|
|
client := db.Redis().GetRedis() |
|
|
|
// 检查集合中是否已经存在该游戏记录
|
|
|
|
// 检查集合中是否已经存在该游戏记录
|
|
|
|
@ -746,6 +747,7 @@ func AddGameRecord(uid int, provider int, gameId int) error { |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
if !exists { |
|
|
|
if !exists { |
|
|
|
|
|
|
|
client.Set(ctx, playerGamesAt, member, 0) |
|
|
|
// 将游戏ID添加到集合进行去重
|
|
|
|
// 将游戏ID添加到集合进行去重
|
|
|
|
client.SAdd(ctx, playerGamesSetKey, member) |
|
|
|
client.SAdd(ctx, playerGamesSetKey, member) |
|
|
|
// 将游戏ID添加到列表的头部
|
|
|
|
// 将游戏ID添加到列表的头部
|
|
|
|
|