游戏列表新增分类查询

This commit is contained in:
tianfeng 2025-12-02 17:23:53 +08:00
parent f7923be435
commit 1d5ddcdf50
9 changed files with 35 additions and 18 deletions

View File

@ -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<GameListConfigCO> listGameConfig(AppExtCommand cmd, @RequestParam(required = false) String roomId) {
public List<GameListConfigCO> listGameConfig(GameListQryCmd cmd, @RequestParam(required = false) String roomId) {
cmd.setRoomSessionId(roomId);
return appConfigService.listGameConfig(cmd);
}

View File

@ -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<GameListConfigCO> execute(AppExtCommand cmd) {
public List<GameListConfigCO> execute(GameListQryCmd cmd) {
List<GameListConfigCO> 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<GameListConfigCO> listGameListConfig(AppExtCommand cmd) {
private List<GameListConfigCO> listGameListConfig(GameListQryCmd cmd) {
return getGameListConfigs(cmd);
}
private List<GameListConfigCO> getGameListConfigs(AppExtCommand cmd) {
private List<GameListConfigCO> 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();

View File

@ -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<GameListConfigCO> listGameConfig(AppExtCommand cmd) {
public List<GameListConfigCO> listGameConfig(GameListQryCmd cmd) {
return gameListConfigQryExe.execute(cmd);
}

View File

@ -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;
}

View File

@ -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<GameListConfigCO> listGameConfig(AppExtCommand cmd);
List<GameListConfigCO> listGameConfig(GameListQryCmd cmd);
GameMatchModelConfigGroupCO getMatchGameConfig(AppExtCommand cmd);

View File

@ -12,7 +12,7 @@ public interface GameListCacheService {
/**
* 获取游戏列表缓存.
*/
String listCache(String sysOrigin, Function<String, String> orElse,String version);
String listCache(String sysOrigin, String category, Function<String, String> orElse,String version);
/**
* 移除缓存.

View File

@ -33,8 +33,8 @@ public class GameListCacheServiceImpl implements GameListCacheService {
private final RedisService redisService;
@Override
public String listCache(String sysOrigin, Function<String, String> orElse, String version) {
String key = GameListKeys.GAME_LIST.getKey(sysOrigin + ":" + version);
public String listCache(String sysOrigin, String category, Function<String, String> 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);

View File

@ -20,7 +20,7 @@ public interface GameListConfigService extends BaseService<GameListConfig> {
/**
* 获取上架配置.
*/
List<GameListConfig> listShowcaseConfig(String sysOrigin);
List<GameListConfig> listShowcaseConfig(String sysOrigin, String category);
/**
* 根据游戏code获得游戏封面图.

View File

@ -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<GameListConfigDAO, GameListConfig> implements GameListConfigService {
@Override
public List<GameListConfig> listShowcaseConfig(String sysOrigin) {
public List<GameListConfig> 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();
}