master
parent
920fc261a5
commit
c22cfc479d
|
|
@ -0,0 +1,60 @@
|
||||||
|
package taurus.newRobot;
|
||||||
|
|
||||||
|
import com.taurus.core.entity.ITArray;
|
||||||
|
import com.taurus.core.entity.ITObject;
|
||||||
|
import com.taurus.core.entity.TObject;
|
||||||
|
import com.taurus.core.plugin.database.DataBase;
|
||||||
|
import com.taurus.core.plugin.redis.Redis;
|
||||||
|
import redis.clients.jedis.Jedis;
|
||||||
|
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AddRedisRobot {
|
||||||
|
|
||||||
|
|
||||||
|
public void getData() {
|
||||||
|
HashMap<String, String> robotMap = new HashMap<>();
|
||||||
|
Jedis jedis2 = Redis.use("group1_db2").getJedis();
|
||||||
|
//取出可用的机器人
|
||||||
|
String sql = String.format("SELECT id FROM `account` WHERE jiqiren=9998 and start = 0");
|
||||||
|
ITArray robotIds = null;
|
||||||
|
try {
|
||||||
|
robotIds = DataBase.use().executeQueryByTArray(sql);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
if (robotIds != null){
|
||||||
|
for (int i = 0; i < robotIds.size(); i++) {
|
||||||
|
ITObject robot = robotIds.getTObject(i);
|
||||||
|
Integer robotId = robot.getInt("id");
|
||||||
|
|
||||||
|
|
||||||
|
robotMap.put("start", 0+"");
|
||||||
|
jedis2.hmset("{robot}:" + robotId , robotMap);
|
||||||
|
|
||||||
|
//后续改为1
|
||||||
|
// String sqls = String.format("UPDATE `account` SET start = %d WHERE id = %d", 1, robotId);
|
||||||
|
|
||||||
|
//对比 mysql和redis的机器人 把新的加到redis ,redis没有的mysql存在的
|
||||||
|
|
||||||
|
jedis2.close();
|
||||||
|
// try {
|
||||||
|
// DataBase.use().executeUpdate(sqls);
|
||||||
|
// } catch (SQLException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -4,9 +4,11 @@ import hunan.HuNanChangSha;
|
||||||
import hunan.HuNanHongZhong;
|
import hunan.HuNanHongZhong;
|
||||||
import hunan.JiQiRens;
|
import hunan.JiQiRens;
|
||||||
import taurus.client.NetManager;
|
import taurus.client.NetManager;
|
||||||
|
import taurus.newRobot.AddRedisRobot;
|
||||||
|
import taurus.newRobot.AddRoomRobot;
|
||||||
import taurus.util.HongZhongSuanFaTest;
|
import taurus.util.HongZhongSuanFaTest;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.*;
|
||||||
|
|
||||||
//import java.sql.SQLException;
|
//import java.sql.SQLException;
|
||||||
//import java.util.ArrayList;
|
//import java.util.ArrayList;
|
||||||
|
|
@ -43,6 +45,33 @@ import java.util.Arrays;
|
||||||
//import taurus.util.PaoDeKuaiSuanFaTest;
|
//import taurus.util.PaoDeKuaiSuanFaTest;
|
||||||
//
|
//
|
||||||
public class Test {
|
public class Test {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
PluginService.me().loadConfig();
|
||||||
|
} catch (Exception e1) {
|
||||||
|
e1.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// AddRedisRobot addRedisRobot = new AddRedisRobot();
|
||||||
|
// addRedisRobot.getData();
|
||||||
|
|
||||||
|
AddRoomRobot addRoomRobot = new AddRoomRobot();
|
||||||
|
addRoomRobot.addRoom();
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
NetManager.processEvents();
|
||||||
|
try {
|
||||||
|
Thread.sleep(8);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// // 扣点点玩家手牌
|
// // 扣点点玩家手牌
|
||||||
// public static List<Integer> cardInhand = new ArrayList<Integer>();
|
// public static List<Integer> cardInhand = new ArrayList<Integer>();
|
||||||
//
|
//
|
||||||
|
|
@ -636,7 +665,7 @@ public class Test {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -650,7 +679,7 @@ public class Test {
|
||||||
// Boolean s = HuNanHongZhong.shouldPong(207);
|
// Boolean s = HuNanHongZhong.shouldPong(207);
|
||||||
// hongZhongSuanFaTest.separateAndAnalyzeHand(Arrays.asList(101, 101, 101, 102, 103, 204, 204, 206, 209, 303, 305, 306, 306, 208));
|
// hongZhongSuanFaTest.separateAndAnalyzeHand(Arrays.asList(101, 101, 101, 102, 103, 204, 204, 206, 209, 303, 305, 306, 306, 208));
|
||||||
// System.out.println(s);
|
// System.out.println(s);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// public static void main(String[] args) {
|
// public static void main(String[] args) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue