diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/sys/query/GameListConfigQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/sys/query/GameListConfigQryExe.java index fb4a3892..93edf9be 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/sys/query/GameListConfigQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/sys/query/GameListConfigQryExe.java @@ -6,7 +6,10 @@ import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.other.app.convertor.sys.SysConfigAppConvertor; import com.red.circle.other.app.dto.clientobject.sys.GameListConfigCO; import com.red.circle.other.app.dto.cmd.game.GameListQryCmd; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.domain.model.user.UserProfile; +import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.cache.service.other.GameListCacheService; import com.red.circle.other.infra.database.rds.service.live.RoomMemberService; import com.red.circle.other.infra.database.rds.service.sys.GameListConfigService; @@ -15,14 +18,17 @@ import com.red.circle.other.infra.database.rds.service.user.device.LatestMobileD import com.red.circle.other.infra.database.rds.entity.user.user.LatestMobileDevice; import com.red.circle.other.infra.utils.IpCountryUtils; import com.red.circle.other.inner.enums.live.RoomUserRolesEnum; +import com.red.circle.other.inner.model.dto.sys.EnumConfigDTO; import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.json.JacksonUtils; import com.red.circle.tool.core.text.StringUtils; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -39,7 +45,10 @@ import org.springframework.stereotype.Component; public class GameListConfigQryExe { private static final String COMMON = "COMMON"; + private static final String IOS_GAME_USER_WHITE_LIST = "IOS_GAME_USER_WHITE_LIST"; private final UserRegionGateway userRegionGateway; + private final UserProfileGateway userProfileGateway; + private final EnumConfigCacheService enumConfigCacheService; private final SysConfigAppConvertor sysConfigAppConvertor; private final GameListCacheService gameListCacheService; private final RoomMemberService roomMemberService; @@ -93,6 +102,27 @@ public class GameListConfigQryExe { return configs; } + /** + * 判断用户是否在 ios游戏用户白名单 中. + * 枚举配置:code=IOS_GAME_USER_WHITE_LIST,val 为逗号分隔的短用户ID(account),如 8826602,8826603 + */ + private boolean isIosGameWhiteListUser(Long userId) { + if (userId == null) { + return false; + } + EnumConfigDTO configDTO = enumConfigCacheService.getByCode(IOS_GAME_USER_WHITE_LIST, "LIKEI"); + String whiteConfig = Optional.ofNullable(configDTO).map(EnumConfigDTO::getVal).orElse(null); + if (StringUtils.isBlank(whiteConfig)) { + return false; + } + UserProfile userProfile = userProfileGateway.getByUserId(userId); + if (userProfile == null) { + return false; + } + List whiteIds = Arrays.asList(whiteConfig.split(",")); + return whiteIds.contains(userProfile.getAccount()); + } + // 解析 游戏 URL 参数 private Map parseUrlParams(String url) { Map params = new HashMap<>(); @@ -142,6 +172,10 @@ public class GameListConfigQryExe { .filter(config -> Objects.equals(config.getClientOrigin(), "IOS") || Objects .equals(config.getClientOrigin(), COMMON)) .toList(); + // ios游戏用户白名单:白名单用户不过滤,否则只返回 CASUAL 分类 + if (isIosGameWhiteListUser(cmd.requiredReqUserId())) { + return iosConfigs; + } return iosConfigs.stream() .filter(config -> Objects.equals(config.getCategory(), "CASUAL")) .toList();