From 1d5ddcdf509139e12b76fe21eacf06c179800869 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 2 Dec 2025 17:23:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=B8=E6=88=8F=E5=88=97=E8=A1=A8=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=88=86=E7=B1=BB=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../adapter/app/sys/AppConfigRestController.java | 5 +++-- .../command/sys/query/GameListConfigQryExe.java | 14 ++++++-------- .../app/service/sys/AppConfigServiceImpl.java | 3 ++- .../other/app/dto/cmd/game/GameListQryCmd.java | 14 ++++++++++++++ .../other/app/service/sys/AppConfigService.java | 3 ++- .../cache/service/other/GameListCacheService.java | 2 +- .../other/impl/GameListCacheServiceImpl.java | 4 ++-- .../rds/service/sys/GameListConfigService.java | 2 +- .../sys/impl/GameListConfigServiceImpl.java | 6 ++++-- 9 files changed, 35 insertions(+), 18 deletions(-) create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/game/GameListQryCmd.java diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/sys/AppConfigRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/sys/AppConfigRestController.java index be57d50e..3c293d82 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/sys/AppConfigRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/sys/AppConfigRestController.java @@ -14,6 +14,7 @@ import com.red.circle.other.app.dto.clientobject.sys.GameListConfigCO; import com.red.circle.other.app.dto.clientobject.sys.GameMatchModelConfigGroupCO; import com.red.circle.other.app.dto.clientobject.sys.NoticeMessageCO; import com.red.circle.other.app.dto.clientobject.sys.SudCodeCO; +import com.red.circle.other.app.dto.cmd.game.GameListQryCmd; import com.red.circle.other.app.service.sys.AppConfigService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.model.user.UserConsumptionLevel; @@ -62,7 +63,7 @@ public class AppConfigRestController extends BaseController { * 房间内-快捷入口-游戏. */ @GetMapping("/room/shortcut-game") - public GameListConfigCO getRoomShortcutGame(AppExtCommand cmd) { + public GameListConfigCO getRoomShortcutGame(GameListQryCmd cmd) { String gameIdStr = enumConfigCacheService.getValue(EnumConfigKey.ROOM_SHORTCUT_GAME_ID, cmd.requireReqSysOrigin()); @@ -95,7 +96,7 @@ public class AppConfigRestController extends BaseController { * @eo.request-type formdata */ @GetMapping("/list-game-config") - public List listGameConfig(AppExtCommand cmd, @RequestParam(required = false) String roomId) { + public List listGameConfig(GameListQryCmd cmd, @RequestParam(required = false) String roomId) { cmd.setRoomSessionId(roomId); return appConfigService.listGameConfig(cmd); } 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 93bcfa30..d87b8f86 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 @@ -5,6 +5,7 @@ import com.google.common.collect.Lists; 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.ability.UserRegionGateway; import com.red.circle.other.infra.database.cache.service.other.GameListCacheService; import com.red.circle.other.infra.database.rds.service.live.RoomMemberService; @@ -40,14 +41,11 @@ public class GameListConfigQryExe { private final RoomMemberService roomMemberService; private final GameListConfigService gameListConfigService; - public List execute(AppExtCommand cmd) { + public List execute(GameListQryCmd cmd) { List configs = listGameListConfig(cmd); - if (CollectionUtils.isEmpty(configs)) { return configs; } - // 弹幕游戏 - configs = isBarrageGame(cmd, configs); // 获得用户区域 String regionId = userRegionGateway.getRegionId(cmd.requiredReqUserId()); @@ -101,15 +99,15 @@ public class GameListConfigQryExe { return params; } - private List listGameListConfig(AppExtCommand cmd) { + private List listGameListConfig(GameListQryCmd cmd) { return getGameListConfigs(cmd); } - private List getGameListConfigs(AppExtCommand cmd) { + private List getGameListConfigs(GameListQryCmd cmd) { - String data = gameListCacheService.listCache(cmd.requireReqSysOrigin(), + String data = gameListCacheService.listCache(cmd.requireReqSysOrigin(),String.valueOf(cmd.getCategory()), sysOrigin -> JacksonUtils.toJson(sysConfigAppConvertor.toListGameListConfigCO( - gameListConfigService.listShowcaseConfig(cmd.requireReqSysOrigin()))), cmd.getReqAppIntel().getVersion()); + gameListConfigService.listShowcaseConfig(cmd.requireReqSysOrigin(), cmd.getCategory()))), cmd.getReqAppIntel().getVersion()); if (StringUtils.isBlank(data)) { return Lists.newArrayList(); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/sys/AppConfigServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/sys/AppConfigServiceImpl.java index a934cbee..bc93897f 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/sys/AppConfigServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/sys/AppConfigServiceImpl.java @@ -19,6 +19,7 @@ import com.red.circle.other.app.dto.clientobject.sys.CountryCodeCO; import com.red.circle.other.app.dto.clientobject.sys.GameListConfigCO; import com.red.circle.other.app.dto.clientobject.sys.GameMatchModelConfigGroupCO; import com.red.circle.other.app.dto.clientobject.sys.NoticeMessageCO; +import com.red.circle.other.app.dto.cmd.game.GameListQryCmd; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import java.util.List; import java.util.Map; @@ -56,7 +57,7 @@ public class AppConfigServiceImpl implements AppConfigService { @Override - public List listGameConfig(AppExtCommand cmd) { + public List listGameConfig(GameListQryCmd cmd) { return gameListConfigQryExe.execute(cmd); } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/game/GameListQryCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/game/GameListQryCmd.java new file mode 100644 index 00000000..c01068aa --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/game/GameListQryCmd.java @@ -0,0 +1,14 @@ +package com.red.circle.other.app.dto.cmd.game; + +import com.red.circle.common.business.dto.cmd.AppExtCommand; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +@EqualsAndHashCode(callSuper = true) +@Data +public class GameListQryCmd extends AppExtCommand { + + private String category; + +} diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/sys/AppConfigService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/sys/AppConfigService.java index 15bb4b25..cc449971 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/sys/AppConfigService.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/sys/AppConfigService.java @@ -10,6 +10,7 @@ import com.red.circle.other.app.dto.clientobject.sys.CountryCodeCO; import com.red.circle.other.app.dto.clientobject.sys.GameListConfigCO; import com.red.circle.other.app.dto.clientobject.sys.GameMatchModelConfigGroupCO; import com.red.circle.other.app.dto.clientobject.sys.NoticeMessageCO; +import com.red.circle.other.app.dto.cmd.game.GameListQryCmd; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import java.util.List; @@ -22,7 +23,7 @@ import java.util.Map; */ public interface AppConfigService { - List listGameConfig(AppExtCommand cmd); + List listGameConfig(GameListQryCmd cmd); GameMatchModelConfigGroupCO getMatchGameConfig(AppExtCommand cmd); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/GameListCacheService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/GameListCacheService.java index 1dcbe30d..21583199 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/GameListCacheService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/GameListCacheService.java @@ -12,7 +12,7 @@ public interface GameListCacheService { /** * 获取游戏列表缓存. */ - String listCache(String sysOrigin, Function orElse,String version); + String listCache(String sysOrigin, String category, Function orElse,String version); /** * 移除缓存. diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/GameListCacheServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/GameListCacheServiceImpl.java index 60818259..58854090 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/GameListCacheServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/cache/service/other/impl/GameListCacheServiceImpl.java @@ -33,8 +33,8 @@ public class GameListCacheServiceImpl implements GameListCacheService { private final RedisService redisService; @Override - public String listCache(String sysOrigin, Function orElse, String version) { - String key = GameListKeys.GAME_LIST.getKey(sysOrigin + ":" + version); + public String listCache(String sysOrigin, String category, Function orElse, String version) { + String key = GameListKeys.GAME_LIST.getKey(sysOrigin + ":" + category + ":" + version); String data = redisService.getString(key); if (StringUtils.isBlank(data)) { String newData = orElse.apply(sysOrigin); diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/GameListConfigService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/GameListConfigService.java index a07f636e..a4b0b676 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/GameListConfigService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/GameListConfigService.java @@ -20,7 +20,7 @@ public interface GameListConfigService extends BaseService { /** * 获取上架配置. */ - List listShowcaseConfig(String sysOrigin); + List listShowcaseConfig(String sysOrigin, String category); /** * 根据游戏code获得游戏封面图. diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/GameListConfigServiceImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/GameListConfigServiceImpl.java index 888f6f18..68aec043 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/GameListConfigServiceImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/sys/impl/GameListConfigServiceImpl.java @@ -2,6 +2,7 @@ package com.red.circle.other.infra.database.rds.service.sys.impl; import com.red.circle.framework.dto.PageResult; import com.red.circle.framework.mybatis.constant.PageConstant; +import com.red.circle.framework.mybatis.entity.TimestampBaseEntity; import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl; import com.red.circle.other.infra.database.rds.dao.sys.GameListConfigDAO; import com.red.circle.other.infra.database.rds.entity.sys.GameListConfig; @@ -27,11 +28,12 @@ public class GameListConfigServiceImpl extends BaseServiceImpl implements GameListConfigService { @Override - public List listShowcaseConfig(String sysOrigin) { + public List listShowcaseConfig(String sysOrigin, String category) { return query() .eq(GameListConfig::getSysOrigin, sysOrigin) + .eq(StringUtils.isNotBlank(category), GameListConfig::getCategory, category) .eq(GameListConfig::getShowcase, Boolean.TRUE) - .orderByDesc(GameListConfig::getSort) + .orderByDesc(TimestampBaseEntity::getCreateTime, GameListConfig::getSort) .list(); }