Hide provider game lists for test user
This commit is contained in:
parent
81cdba4096
commit
8147b5981f
@ -72,9 +72,17 @@ func registerGameProviderRoutes(engine *gin.Engine, javaClient authGateway, regi
|
|||||||
providerGroup := engine.Group("/app/game/providers")
|
providerGroup := engine.Group("/app/game/providers")
|
||||||
providerGroup.Use(authMiddleware(javaClient))
|
providerGroup.Use(authMiddleware(javaClient))
|
||||||
providerGroup.GET("", func(c *gin.Context) {
|
providerGroup.GET("", func(c *gin.Context) {
|
||||||
|
if gameprovider.IsEmptyGameListUser(mustAuthUser(c).UserID) {
|
||||||
|
writeOK(c, gameprovider.ProviderListResponse{Items: []gameprovider.ProviderSummary{}})
|
||||||
|
return
|
||||||
|
}
|
||||||
writeOK(c, registry.List())
|
writeOK(c, registry.List())
|
||||||
})
|
})
|
||||||
providerGroup.GET("/:provider/room/shortcut", func(c *gin.Context) {
|
providerGroup.GET("/:provider/room/shortcut", func(c *gin.Context) {
|
||||||
|
if gameprovider.IsEmptyGameListUser(mustAuthUser(c).UserID) {
|
||||||
|
writeOK(c, gin.H{"items": []publicRoomGameItem{}})
|
||||||
|
return
|
||||||
|
}
|
||||||
provider, ok := resolveGameProvider(c, registry)
|
provider, ok := resolveGameProvider(c, registry)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
@ -87,6 +95,10 @@ func registerGameProviderRoutes(engine *gin.Engine, javaClient authGateway, regi
|
|||||||
writeOK(c, gin.H{"items": publicRoomGameItems(resp)})
|
writeOK(c, gin.H{"items": publicRoomGameItems(resp)})
|
||||||
})
|
})
|
||||||
providerGroup.GET("/:provider/room/list", func(c *gin.Context) {
|
providerGroup.GET("/:provider/room/list", func(c *gin.Context) {
|
||||||
|
if gameprovider.IsEmptyGameListUser(mustAuthUser(c).UserID) {
|
||||||
|
writeOK(c, publicRoomGameListResponse(&gameprovider.RoomGameListResponse{Items: []gameprovider.RoomGameListItem{}}))
|
||||||
|
return
|
||||||
|
}
|
||||||
provider, ok := resolveGameProvider(c, registry)
|
provider, ok := resolveGameProvider(c, registry)
|
||||||
if !ok {
|
if !ok {
|
||||||
return
|
return
|
||||||
|
|||||||
@ -79,7 +79,7 @@ func (r *Registry) List() ProviderListResponse {
|
|||||||
|
|
||||||
// ListShortcutGames 返回聚合后的快捷游戏列表。
|
// ListShortcutGames 返回聚合后的快捷游戏列表。
|
||||||
func (r *Registry) ListShortcutGames(ctx context.Context, user AuthUser, roomID string) ([]RoomGameListItem, error) {
|
func (r *Registry) ListShortcutGames(ctx context.Context, user AuthUser, roomID string) ([]RoomGameListItem, error) {
|
||||||
if isEmptyGameListUser(user.UserID) {
|
if IsEmptyGameListUser(user.UserID) {
|
||||||
return []RoomGameListItem{}, nil
|
return []RoomGameListItem{}, nil
|
||||||
}
|
}
|
||||||
if r == nil || len(r.ordered) == 0 {
|
if r == nil || len(r.ordered) == 0 {
|
||||||
@ -103,7 +103,7 @@ func (r *Registry) ListShortcutGames(ctx context.Context, user AuthUser, roomID
|
|||||||
|
|
||||||
// ListRoomGames 返回聚合后的房间游戏列表。
|
// ListRoomGames 返回聚合后的房间游戏列表。
|
||||||
func (r *Registry) ListRoomGames(ctx context.Context, user AuthUser, roomID, category string) (*RoomGameListResponse, error) {
|
func (r *Registry) ListRoomGames(ctx context.Context, user AuthUser, roomID, category string) (*RoomGameListResponse, error) {
|
||||||
if isEmptyGameListUser(user.UserID) {
|
if IsEmptyGameListUser(user.UserID) {
|
||||||
return &RoomGameListResponse{Items: []RoomGameListItem{}}, nil
|
return &RoomGameListResponse{Items: []RoomGameListItem{}}, nil
|
||||||
}
|
}
|
||||||
if r == nil || len(r.ordered) == 0 {
|
if r == nil || len(r.ordered) == 0 {
|
||||||
@ -124,7 +124,7 @@ func (r *Registry) ListRoomGames(ctx context.Context, user AuthUser, roomID, cat
|
|||||||
return &RoomGameListResponse{Items: items}, nil
|
return &RoomGameListResponse{Items: items}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func isEmptyGameListUser(userID int64) bool {
|
func IsEmptyGameListUser(userID int64) bool {
|
||||||
_, ok := emptyGameListUserIDs[userID]
|
_, ok := emptyGameListUserIDs[userID]
|
||||||
return ok
|
return ok
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user