use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method getUserMessage.
public int getUserMessage(KafkaMsgKey msgKey) {
UserBean userBean = userRedisService.getUserBean(msgKey.getUserId());
if (userBean == null) {
return ErrorCode.YOU_HAVE_NOT_LOGIN;
}
String roomId = userRedisService.getRoomId(msgKey.getUserId());
UserVo userVo = userBean.toVo();
userVo.setRoomId(roomId);
ResponseVo vo = new ResponseVo("userService", "getUserMessage", userVo);
sendMsg(msgKey, vo);
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method getNickNamePlayer.
/**
* 获取昵称
*
* @param msgKey
* @return
*/
public int getNickNamePlayer(KafkaMsgKey msgKey) {
UserBean userBean = userRedisService.getUserBean(msgKey.getUserId());
if (userBean == null) {
return ErrorCode.YOU_HAVE_NOT_LOGIN;
}
Map<String, Object> results = new HashMap<String, Object>();
try {
results.put("nickname", userBean.getUsername());
} catch (Exception e) {
ResponseVo vo = new ResponseVo("userService", "getNickNamePlayer", ErrorCode.NOT_HAVE_THIS_ACCEPTER);
sendMsg(msgKey, vo);
}
ResponseVo vo = new ResponseVo("userService", "getNickNamePlayer", results);
sendMsg(msgKey, vo);
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method getPrepareRoom.
public int getPrepareRoom(KafkaMsgKey msgKey) {
long userId = msgKey.getUserId();
Map<String, PrepareRoom> rooms = RedisManager.getUserRedisService().getPerpareRoom(userId);
Map<Object, Object> result = new HashMap<>();
List<Map<String, Object>> list = new ArrayList<>();
if (rooms != null) {
for (Map.Entry<String, PrepareRoom> entry : rooms.entrySet()) {
Map<String, Object> temp = new HashMap<>();
temp.put("room", entry.getValue());
temp.put("user", RedisManager.getUserRedisService().getUserBeans(RedisManager.getRoomRedisService().getUsers(entry.getKey())));
list.add(temp);
}
}
result.put("result", list);
ResponseVo vo = new ResponseVo("userService", "getPrepareRoom", result);
sendMsg(msgKey, vo);
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method getCoords.
/**
* 获得同一房间的所有人坐标
*
* @param msgKey
* @return
*/
public int getCoords(KafkaMsgKey msgKey) {
long userId = msgKey.getUserId();
String roomId = RedisManager.getUserRedisService().getRoomId(userId);
if (roomId == null) {
return ErrorCode.CAN_NOT_NO_ROOM;
}
Set<Long> users = RedisManager.getRoomRedisService().getUsers(roomId);
Map<Long, Object> result = RedisManager.getUserRedisService().getUserBeans(users).stream().collect(Collectors.toMap(UserBean::getId, UserBean::getCoord));
sendMsg(msgKey, new ResponseVo("userService", "getCoords", result));
return 0;
}
use of com.code.server.constant.response.ResponseVo in project summer by foxsugar.
the class GameUserService method setReplay.
public int setReplay(KafkaMsgKey msgKey, long id) {
ReplayService rs = SpringUtil.getBean(ReplayService.class);
// boolean isSuccess = rs.decReplayCount(id);
// if (!isSuccess) {
// return ErrorCode.REPLAY_NOT_EXIST;
// }
rs.decReplayCount(id);
ResponseVo vo = new ResponseVo("userService", "setReplay", 0);
sendMsg(msgKey, vo);
return 0;
}
Aggregations