use of com.code.server.constant.response.ClubVo in project summer by foxsugar.
the class GameClubService method getClubVo_simple.
/**
* 获得俱乐部简要信息
*
* @param club
* @return
*/
private ClubVo getClubVo_simple(Club club) {
if (club == null) {
return new ClubVo();
}
ClubVo clubVo = new ClubVo();
clubVo.setId(club.getId());
clubVo.setPresident(club.getPresident());
clubVo.setName(club.getName());
clubVo.setPresidentName(club.getPresidentName());
clubVo.setNum(club.getClubInfo().getMember().size());
clubVo.setMoney(club.getMoney());
clubVo.setArea(club.getArea());
clubVo.setPresidentWx(club.getPresidentWx());
clubVo.setApplyNum(club.getClubInfo().getApplyList().size());
return clubVo;
}
use of com.code.server.constant.response.ClubVo in project summer by foxsugar.
the class GameClubService method lookClub.
/**
* 查看俱乐部
*
* @param msgKey
* @param userId
* @return
*/
public int lookClub(KafkaMsgKey msgKey, long userId) {
List<ClubVo> list = new ArrayList<>();
List<String> clubs = ClubManager.getInstance().getUserClubs(userId);
for (String clubId : clubs) {
list.add(getClubVo_simple(ClubManager.getInstance().getClubById(clubId)));
}
sendMsg(msgKey, new ResponseVo("clubService", "lookClub", list));
return 0;
}
use of com.code.server.constant.response.ClubVo in project summer by foxsugar.
the class GameClubService method getClubInfo.
/**
* 获得俱乐部信息
*
* @param msgKey
* @param userId
* @param clubId
* @return
*/
public int getClubInfo(KafkaMsgKey msgKey, long userId, String clubId) {
Club club = ClubManager.getInstance().getClubById(clubId);
if (club == null) {
return ErrorCode.CLUB_NO_THIS;
}
// 刷新房间
initRoomInstance(club);
boolean isPresident = club.getPresident() == userId;
ClubVo clubVo = getClubVo_simple(club);
clubVo.getRoomModels().addAll(club.getClubInfo().getRoomModels());
// 玩家在线情况
clubVo.getMember().addAll(club.getClubInfo().getMember().values());
clubVo.getMember().forEach(clubMember -> {
String gateId = RedisManager.getUserRedisService().getGateId(clubMember.getUserId());
boolean online = gateId != null;
clubMember.setOnline(online);
});
club.getClubInfo().getRoomInstance().values().forEach(roomInstance -> {
if (roomInstance.getRoomId() != null) {
clubVo.getRoomInstance().add(getRoomInstanceVo(roomInstance));
}
});
// 房间情况
if (isPresident) {
clubVo.getApplyList().addAll(club.getClubInfo().getApplyList());
}
// todo 初始化数据
// todo 更改玩家真实信息
UserBean userBean = RedisManager.getUserRedisService().getUserBean(userId);
if (isPresident) {
club.setPresidentName(userBean.getUsername());
}
ClubMember clubMember = club.getClubInfo().getMember().get("" + userId);
clubMember.setName(userBean.getUsername());
clubMember.setImage(userBean.getImage());
// 发送结果
sendMsg(msgKey, new ResponseVo("clubService", "getClubInfo", clubVo));
return 0;
}
Aggregations