// 玩家是否加入指定比赛 public boolean isJoinMatch(Integer matchconfigId, Long fbid) { RedisMapSimple<Integer, String> matchPlayerMap = new RedisMapSimple<Integer, String>( "matchplayer" + matchconfigId, Integer.class, String.class); if (matchPlayerMap.containsKey(fbid)) return true; return false; }
/** * 打开比赛详情面板 * * @param logicRequest */ @RPCReponse(EventDefinition.EVENT_LOOKMATCHDETAIL) public Object e_LookMatchDetail(LogicRequest logicRequest) { try { // 1. 读取用户数据 MatchOp packet = ObjectBeanUtil.JACKSON.readValue(logicRequest.getData(), MatchOp.class); Long fbid = packet.getFbid(); int matchconfigId = packet.getMi(); if (matchDetailMap.containsKey(matchconfigId) == false) return null; // 返回比赛详情信息 return matchDetailMap.get(matchconfigId); } catch (Exception e) { } return null; }
@Override @RPCReponse("e_getoffrooms") public ResultVo getOffRooms(LogicRequest args) { // TODO 自动生成的方法存根 ResultVo vo = null; Long fbid = null; try { FlashLoginOp op = ObjectBeanUtil.JACKSON.readValue(args.getData(), FlashLoginOp.class); if (op != null) { fbid = op.getFbid(); List<UserInRoom> resultList = new ArrayList<UserInRoom>(); List<UserInRoom> userInRoomList = LocalCache.USER_IN_ROOM.get(String.valueOf(op.getFbid())); // 普通房间 if (userInRoomList != null) { UserInRoom inRoom = null; Rooms room = null; for (int i = 0; i < userInRoomList.size(); i++) { inRoom = userInRoomList.get(i); if (inRoom.getIsSit() == 1 || inRoom.getIsSit() == 2) { room = LocalCache.getRoom(inRoom.getRid()); if (room != null) { inRoom.setGt(room.getGt()); // 强制更新 userInRoomList.set(i, inRoom); } resultList.add(inRoom); } } } // 技术债务, 比赛房间断线重连 RedisMapMap<Integer /*playerId*/, UserInRoom> roomMapCache = new RedisMapMap<Integer /*playerId*/, UserInRoom>( "matchroom", Integer.class, UserInRoom.class); RedisMapSimple<Integer /*roomId*/, UserInRoom> roommap = roomMapCache.get(op.getFbid()); if (null != roommap) { for (UserInRoom inRoom : roommap.values()) { resultList.add(inRoom); } } // List<UserInRoom> matchUserInRoomList = // LocalMatchCache.MATCH_USER_IN_ROOM.get(String.valueOf(op.getFbid()));// 比赛房间 // if (matchUserInRoomList != null) { // UserInRoom inRoom = null; // for (int i = 0; i < matchUserInRoomList.size(); i++) { // inRoom = matchUserInRoomList.get(i); // if (inRoom.getIsSit() == 1 || inRoom.getIsSit() == 2) { // Match match = LocalMatchCache.MATCHS.get(inRoom.getMi()); // if (match != null) { // MatchUser mu = match.getUsers().get(op.getFbid()); // if (mu != null && mu.getRanking() == 0) {// 没有淘汰 // resultList.add(inRoom); // } // } // } // } // } // 成功 vo = new ResultVo(Definition.GETOFFROOMS, Definition.SUCCESS_CODE, resultList); } else { vo = new ResultVo(Definition.GETOFFROOMS, Definition.ARG_CODE, null); // Logger.error("deal with getoffroom arg error!!!"); } } catch (Exception e) { vo = new ResultVo(Definition.GETOFFROOMS, Definition.UNKNOW_CODE, null); // Logger.error("deal with getoffroom error !!!",e); } return vo; }