use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class RoomGoldPaijiu method genRoomRecord.
/**
* 生成房间战绩
*/
@Override
public void genRoomRecord() {
RoomRecord roomRecord = new RoomRecord();
roomRecord.setRoomId(this.roomId);
roomRecord.setId(this.getUuid());
roomRecord.setType(this.roomType);
roomRecord.setTime(System.currentTimeMillis());
roomRecord.setClubId(this.getClubId());
roomRecord.setClubRoomModel(this.getClubRoomModel());
for (Long l : userScoresForGold.keySet()) {
UserRecord userRecord = new UserRecord();
userRecord.setScore(userScoresForGold.get(l));
userRecord.setUserId(l);
UserBean userBean = RedisManager.getUserRedisService().getUserBean(l);
if (userBean != null) {
userRecord.setName(userBean.getUsername());
}
roomRecord.getRecords().add(userRecord);
}
KafkaMsgKey kafkaMsgKey = new KafkaMsgKey().setMsgId(KAFKA_MSG_ID_ROOM_RECORD);
MsgProducer msgProducer = SpringUtil.getBean(MsgProducer.class);
msgProducer.send(IKafaTopic.CENTER_TOPIC, kafkaMsgKey, roomRecord);
}
use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class TTZRobot method open.
@Override
public void open(GameTuiTongZi game) {
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
Map<String, Object> put = new HashMap();
for (PlayerTuiTongZi p : game.getPlayerCardInfos().values()) {
if (!p.isOpen()) {
msgKey.setUserId(p.getUserId());
put.put("userId", p.getUserId());
}
}
ResponseRobotVo result = new ResponseRobotVo("gameService", "open", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
}
use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class TTZRobot method crap.
@Override
public void crap(GameTuiTongZi game) {
String roomId = game.getRoom().getRoomId();
int partition = SpringUtil.getBean(ServerConfig.class).getServerId();
KafkaMsgKey msgKey = new KafkaMsgKey();
msgKey.setRoomId(roomId);
msgKey.setPartition(partition);
Map<String, Object> put = new HashMap();
for (PlayerTuiTongZi p : game.getPlayerCardInfos().values()) {
if (p.getUserId() == game.room.getBankerId()) {
msgKey.setUserId(p.getUserId());
put.put("userId", p.getUserId());
}
}
ResponseRobotVo result = new ResponseRobotVo("gameService", "crap", put);
SpringUtil.getBean(MsgProducer.class).send2Partition("gameService", partition, msgKey, result);
}
use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class Room method clubDrawBack.
private void clubDrawBack() {
MsgProducer msgProducer = SpringUtil.getBean(MsgProducer.class);
KafkaMsgKey kafkaKey = new KafkaMsgKey();
kafkaKey.setUserId(0);
Map<String, Object> msg = new HashMap<>();
msg.put("clubId", this.clubId);
msg.put("clubModelId", this.clubRoomModel);
ResponseVo responseVo = new ResponseVo("clubService", "clubDrawBack", msg);
msgProducer.send("clubService", kafkaKey, responseVo);
}
use of com.code.server.constant.kafka.KafkaMsgKey in project summer by foxsugar.
the class Room method notifyCludGameStart.
/**
* 通知 俱乐部游戏开始
*/
public void notifyCludGameStart() {
if (!isOpen && isClubRoom()) {
MsgProducer msgProducer = SpringUtil.getBean(MsgProducer.class);
KafkaMsgKey kafkaKey = new KafkaMsgKey();
kafkaKey.setUserId(0);
Map<String, String> msg = new HashMap<>();
msg.put("clubId", this.clubId);
msg.put("clubModelId", this.clubRoomModel);
msg.put("roomId", this.roomId);
ResponseVo responseVo = new ResponseVo("clubService", "clubGameStart", msg);
msgProducer.send("clubService", kafkaKey, responseVo);
}
}
Aggregations