master
fy 2026-01-28 04:23:18 +08:00
parent c22cfc479d
commit 254fd9ba86
2 changed files with 25 additions and 36 deletions

View File

@ -116,21 +116,21 @@ public class JiQiRens {
if (jedis11.hget(playKey, "leftover_robot") != null) {
if (wanfaId.equals("")) {
Boolean is_match = false;
//查询有房间的时候。房间里的玩法 和 传递过来需要建的玩法是否相等,不相等代表没有这个玩法,需要建立
for (String id : roomIds) {
String roomId = id.substring(id.indexOf(":") + 1);
roomKey = "room:" + roomId;
String gpid = jedis0.hget(roomKey, "gpid");
String players = jedis0.hget(roomKey, "players");
if (gpid != null) {
if (Integer.parseInt(gpid) == pid) {
is_match = true;
}
// if (players.equals("[]")) {
// is_match = false;
// }
}
}
//没有房间,或者房间内的玩法还没有现在传递需要建立的玩法的时候 需要建立房间
if (roomIds.size() == 0 || !is_match) {
ITObject object = null;
AccountBusiness accountBusiness = null;
@ -163,12 +163,8 @@ public class JiQiRens {
session = accountBusiness.getSession();
}
Object room = GroupRoomBusiness.matchRoom(groupId, pid, session, "Android", false);
String game = jedis0.hget(String.valueOf(room), "game");
// ITObject game_info = roomInfo.getTObject("game_info");
// Integer game_id = game_info.getInt("game_id");
wanfaId = String.valueOf(game);
}
@ -217,8 +213,6 @@ public class JiQiRens {
}
Set<String> excludedKeys = xuyaojianlifangjian.stream()
.filter(list -> {
String value = list.get(1);
@ -240,9 +234,6 @@ public class JiQiRens {
List<Integer> robotIdsList1 = new ArrayList<>();
String sql3 = String.format("SELECT id FROM `account` WHERE jiqiren=9998 and start = 0");
@ -301,10 +292,6 @@ public class JiQiRens {
String[] playerIds = null;
String leftover_robot = jedis11.hget(playKey, "leftover_robot");
if (Integer.parseInt(leftover_robot) > 0) {
//真人等机器人游戏id赋值
for (String id : roomIds) {
String roomId = id.substring(id.indexOf(":") + 1);
@ -1295,22 +1282,6 @@ public class JiQiRens {
if (code == SocketCode.Connect) {
} else {
//
//重连
// if ("22".equalsIgnoreCase(wanfaId)) { //湖南红中麻将
// client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
// }
//
// if ("10".equalsIgnoreCase(wanfaId)) {
// client = new TaurusClient("127.0.0.1:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
// }
////
// if ("66".equalsIgnoreCase(wanfaId)) {
// client = new TaurusClient("8.138.242.190:6841", "game", TaurusClient.ConnectionProtocol.Tcp);
// }
// client.connect();
}
}
});

View File

@ -62,6 +62,8 @@ public class AddRoomRobot {
private Map<Integer, List<Integer>> playerzisMap = new HashMap<>();
private Map<String,Object> mapclient = new HashMap<>();
public void addRoom() {
Jedis jedis2 = Redis.use("group1_db2").getJedis();
Jedis jedis11 = Redis.use("group1_db11").getJedis();
@ -226,6 +228,8 @@ public class AddRoomRobot {
System.out.println("wanfaId" + wanfaId);
// List<Object> circleIds = new ArrayList<>();
if ("22".equalsIgnoreCase(wanfaId)) { //湖南红中麻将
client = new TaurusClient("8.138.242.190:6421", "game", TaurusClient.ConnectionProtocol.Tcp);
@ -233,14 +237,16 @@ public class AddRoomRobot {
if ("10".equalsIgnoreCase(wanfaId)) {
client = new TaurusClient("8.138.242.190:6311", "game", TaurusClient.ConnectionProtocol.Tcp);
client.connect();
mapclient.put(randomKeyFromList,client);
}
//
if ("66".equalsIgnoreCase(wanfaId)) {
client = new TaurusClient("8.138.242.190:6841", "game", TaurusClient.ConnectionProtocol.Tcp);
}
client.connect();
System.out.println("mapclient----"+mapclient);
ITObject roomInfos = GroupRoomBusiness.joinRoom(Integer.parseInt(circleId), roomKey, this.session, null);
String roomId = roomInfos.getString("room_id");
String robort = "{robortInfo}:" + randomKeyFromList;
@ -798,9 +804,19 @@ public class AddRoomRobot {
jedis20.close();
System.out.println("client ++++= " + client);
client.send("1005", params, response -> {
for (Map.Entry<String, Object> entry : mapclient.entrySet()) {
String key1 = entry.getKey();
if (Integer.parseInt(key1)==aid){
Object value = entry.getValue();
TaurusClient client1 = (TaurusClient) value;
client1.send("1005", params, response -> {
});
}
}
sleepTime(1000);
jedis33.hset(getKey, "circleId","0");
jedis33.hset(getKey, "pid","0");
@ -1017,6 +1033,8 @@ public class AddRoomRobot {
}
/**
*
*