房间发现列表新增 房间图标字段
This commit is contained in:
parent
227ed9c410
commit
020fc3e543
@ -8,6 +8,7 @@ import com.red.circle.common.business.enums.SVIPLevelEnum;
|
|||||||
import com.red.circle.live.inner.endpoint.LiveMicClient;
|
import com.red.circle.live.inner.endpoint.LiveMicClient;
|
||||||
import com.red.circle.other.app.common.room.RoomVoiceProfileCommon;
|
import com.red.circle.other.app.common.room.RoomVoiceProfileCommon;
|
||||||
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
||||||
|
import com.red.circle.other.app.service.game.GameLudoService;
|
||||||
import com.red.circle.other.app.service.room.RocketStatusCacheService;
|
import com.red.circle.other.app.service.room.RocketStatusCacheService;
|
||||||
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
|
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
|
||||||
import com.red.circle.other.domain.gateway.user.ability.UserSVipGateway;
|
import com.red.circle.other.domain.gateway.user.ability.UserSVipGateway;
|
||||||
@ -57,7 +58,8 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
private final RegionRoomCacheService regionRoomCacheService;
|
private final RegionRoomCacheService regionRoomCacheService;
|
||||||
private final LiveMicClient liveMicClient;
|
private final LiveMicClient liveMicClient;
|
||||||
private final RedisTemplate<String, Object> redisTemplate;
|
private final RedisTemplate<String, Object> redisTemplate;
|
||||||
private final RocketStatusCacheService rocketStatusCacheService;
|
private final RocketStatusCacheService rocketStatusCacheService;
|
||||||
|
private final GameLudoService gameLudoService;
|
||||||
|
|
||||||
private static final String EMPTY_ROOM_CACHE_KEY = "empty_room_cache:*";
|
private static final String EMPTY_ROOM_CACHE_KEY = "empty_room_cache:*";
|
||||||
|
|
||||||
@ -115,10 +117,21 @@ public class RoomVoiceDiscoverQryExe {
|
|||||||
|
|
||||||
// 填充火箭状态
|
// 填充火箭状态
|
||||||
fillRocketStatus(roomList);
|
fillRocketStatus(roomList);
|
||||||
|
// 填充游戏图标
|
||||||
|
fillGameIcon(roomList);
|
||||||
|
|
||||||
return roomList;
|
return roomList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fillGameIcon(List<RoomVoiceProfileCO> roomList) {
|
||||||
|
if (CollectionUtils.isEmpty(roomList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
List<Long> roomIds = roomList.stream().map(RoomVoiceProfileCO::getId).toList();
|
||||||
|
Map<Long, String> coverMap = gameLudoService.listGameCoverByRoomIds(roomIds);
|
||||||
|
roomList.forEach(room -> room.setRoomGameIcon(coverMap.get(room.getId())));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 填充房间的火箭状态信息
|
* 填充房间的火箭状态信息
|
||||||
*
|
*
|
||||||
|
|||||||
@ -11,6 +11,12 @@ import com.red.circle.other.app.command.game.ludo.GameLudoStartCmdExe;
|
|||||||
import com.red.circle.other.app.command.game.ludo.GameRoomExistsQueryExe;
|
import com.red.circle.other.app.command.game.ludo.GameRoomExistsQueryExe;
|
||||||
import com.red.circle.other.app.dto.clientobject.game.GameLudoRunCO;
|
import com.red.circle.other.app.dto.clientobject.game.GameLudoRunCO;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoCreateCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoCreateCmd;
|
||||||
|
import com.red.circle.other.infra.database.mongo.entity.game.ludo.GameLudoRun;
|
||||||
|
import com.red.circle.other.infra.database.mongo.service.game.GameLudoRunService;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoEndCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoEndCmd;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoJoinCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoJoinCmd;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoStartCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoStartCmd;
|
||||||
@ -34,6 +40,7 @@ public class GameLudoServiceImpl implements GameLudoService {
|
|||||||
private final GameLudoRoomRunQueryExe gameLudoRoomRunQueryExe;
|
private final GameLudoRoomRunQueryExe gameLudoRoomRunQueryExe;
|
||||||
private final GameLudoLatestEndCmdExe gameLudoLatestEndCmdExe;
|
private final GameLudoLatestEndCmdExe gameLudoLatestEndCmdExe;
|
||||||
private final GameLudoLatestDisbandCmdExe gameLudoLatestDisbandCmdExe;
|
private final GameLudoLatestDisbandCmdExe gameLudoLatestDisbandCmdExe;
|
||||||
|
private final GameLudoRunService gameLudoRunService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public GameLudoRunCO getRoomGame(AppRoomIdCmd cmd) {
|
public GameLudoRunCO getRoomGame(AppRoomIdCmd cmd) {
|
||||||
@ -70,4 +77,11 @@ public class GameLudoServiceImpl implements GameLudoService {
|
|||||||
gameLudoLatestEndCmdExe.execute(cmd);
|
gameLudoLatestEndCmdExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<Long, String> listGameCoverByRoomIds(List<Long> roomIds) {
|
||||||
|
return gameLudoRunService.listByRoomIds(roomIds).stream()
|
||||||
|
.filter(run -> Objects.nonNull(run.getGameInfo()) && Objects.nonNull(run.getGameInfo().getCover()))
|
||||||
|
.collect(Collectors.toMap(GameLudoRun::getRoomId, run -> run.getGameInfo().getCover(), (a, b) -> a));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@ package com.red.circle.other.app.service.game;
|
|||||||
import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd;
|
import com.red.circle.common.business.dto.cmd.app.AppIdLongCmd;
|
||||||
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
import com.red.circle.common.business.dto.cmd.app.AppRoomIdCmd;
|
||||||
import com.red.circle.other.app.dto.clientobject.game.GameLudoRunCO;
|
import com.red.circle.other.app.dto.clientobject.game.GameLudoRunCO;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoCreateCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoCreateCmd;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoEndCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoEndCmd;
|
||||||
import com.red.circle.other.app.dto.cmd.game.GameLudoJoinCmd;
|
import com.red.circle.other.app.dto.cmd.game.GameLudoJoinCmd;
|
||||||
@ -29,4 +31,9 @@ public interface GameLudoService {
|
|||||||
|
|
||||||
void end(GameLudoEndCmd cmd);
|
void end(GameLudoEndCmd cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量获取房间正在进行的游戏封面,key=roomId,value=cover
|
||||||
|
*/
|
||||||
|
Map<Long, String> listGameCoverByRoomIds(List<Long> roomIds);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,4 +47,9 @@ public interface GameLudoRunService {
|
|||||||
* 移除房间游戏.
|
* 移除房间游戏.
|
||||||
*/
|
*/
|
||||||
void remove(Long id);
|
void remove(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量查询房间游戏.
|
||||||
|
*/
|
||||||
|
List<GameLudoRun> listByRoomIds(List<Long> roomIds);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,6 +82,16 @@ public class GameLudoRunServiceImpl implements GameLudoRunService {
|
|||||||
GameLudoRun.class);
|
GameLudoRun.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<GameLudoRun> listByRoomIds(List<Long> roomIds) {
|
||||||
|
if (roomIds == null || roomIds.isEmpty()) {
|
||||||
|
return List.of();
|
||||||
|
}
|
||||||
|
return mongoTemplate.find(
|
||||||
|
Query.query(Criteria.where("id").in(roomIds)),
|
||||||
|
GameLudoRun.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove(Long id) {
|
public void remove(Long id) {
|
||||||
mongoTemplate.remove(Query.query(Criteria.where("id").is(id)), GameLudoRun.class);
|
mongoTemplate.remove(Query.query(Criteria.where("id").is(id)), GameLudoRun.class);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user