Spaces:
Paused
Paused
htr
commited on
Commit
·
719b709
1
Parent(s):
de59685
Signed-off-by: htr <ht@rdb.y>
Browse files
src/main/java/com/example/demo/DemoApplication.java
CHANGED
|
@@ -80,7 +80,7 @@ public class DemoApplication {
|
|
| 80 |
return "ok";
|
| 81 |
}
|
| 82 |
|
| 83 |
-
@RequestMapping(value = "/stopAll", method = RequestMethod.
|
| 84 |
@ResponseBody
|
| 85 |
public String stopAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
| 86 |
try {
|
|
@@ -97,7 +97,7 @@ public class DemoApplication {
|
|
| 97 |
}
|
| 98 |
|
| 99 |
|
| 100 |
-
@RequestMapping(value = "/resumeAll", method = RequestMethod.
|
| 101 |
@ResponseBody
|
| 102 |
public String resumeAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
| 103 |
try {
|
|
@@ -112,7 +112,26 @@ public class DemoApplication {
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
} catch (Exception e) {
|
| 115 |
-
return
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 116 |
}
|
| 117 |
return "ok";
|
| 118 |
}
|
|
@@ -206,14 +225,20 @@ public class DemoApplication {
|
|
| 206 |
@GetMapping("setSessionId")
|
| 207 |
public String setSessionId(@RequestParam(value = "id", required = true) String id,
|
| 208 |
@RequestParam(value = "session", required = true) String session) throws Exception {
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 216 |
}
|
|
|
|
| 217 |
return "not-ok";
|
| 218 |
}
|
| 219 |
|
|
|
|
| 80 |
return "ok";
|
| 81 |
}
|
| 82 |
|
| 83 |
+
@RequestMapping(value = "/stopAll", method = RequestMethod.GET)
|
| 84 |
@ResponseBody
|
| 85 |
public String stopAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
| 86 |
try {
|
|
|
|
| 97 |
}
|
| 98 |
|
| 99 |
|
| 100 |
+
@RequestMapping(value = "/resumeAll", method = RequestMethod.GET)
|
| 101 |
@ResponseBody
|
| 102 |
public String resumeAll() throws IOException, UnknownHostException, InterruptedException, Exception {
|
| 103 |
try {
|
|
|
|
| 112 |
}
|
| 113 |
}
|
| 114 |
} catch (Exception e) {
|
| 115 |
+
return e.getMessage();
|
| 116 |
+
}
|
| 117 |
+
return "ok";
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
@RequestMapping(value = "/resumeOne", method = RequestMethod.GET)
|
| 122 |
+
@ResponseBody
|
| 123 |
+
public String resumeOne(@RequestParam(value = "id", required = true) String id) throws IOException, UnknownHostException, InterruptedException, Exception {
|
| 124 |
+
try {
|
| 125 |
+
|
| 126 |
+
for (int i = 0; i < Tqtk.listWorker.size(); ++i) {
|
| 127 |
+
if (id.equals(Tqtk.listWorker.get(i).getSs().getUserId())) {
|
| 128 |
+
|
| 129 |
+
Tqtk.listWorker.get(i).createSocket1(Tqtk.listWorker.get(i).getSs());
|
| 130 |
+
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
} catch (Exception e) {
|
| 134 |
+
return e.getMessage();
|
| 135 |
}
|
| 136 |
return "ok";
|
| 137 |
}
|
|
|
|
| 225 |
@GetMapping("setSessionId")
|
| 226 |
public String setSessionId(@RequestParam(value = "id", required = true) String id,
|
| 227 |
@RequestParam(value = "session", required = true) String session) throws Exception {
|
| 228 |
+
|
| 229 |
+
try {
|
| 230 |
+
|
| 231 |
+
for (int i = 0; i < Tqtk.listWorker.size(); ++i) {
|
| 232 |
+
if (id.equals(Tqtk.listWorker.get(i).getSs().getUserId())) {
|
| 233 |
+
|
| 234 |
+
Tqtk.listWorker.get(i).getSs().setSessionKey(session);
|
| 235 |
+
return "ok";
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
} catch (Exception e) {
|
| 239 |
+
return e.getMessage();
|
| 240 |
}
|
| 241 |
+
|
| 242 |
return "not-ok";
|
| 243 |
}
|
| 244 |
|
src/main/java/tqtk/XuLy/Worker.java
CHANGED
|
@@ -699,8 +699,8 @@ public class Worker extends Thread {
|
|
| 699 |
GuiPacket(ss, "12302", null);
|
| 700 |
|
| 701 |
// event mo ruong
|
| 702 |
-
Thread.sleep(5000);
|
| 703 |
-
GuiPacket(ss, "48113", list1);
|
| 704 |
|
| 705 |
// nhiem vu thuong ngay
|
| 706 |
Thread.sleep(5000);
|
|
@@ -723,12 +723,12 @@ public class Worker extends Thread {
|
|
| 723 |
Thread.sleep(2000);
|
| 724 |
GuiPacket(ss, "49007", list1);
|
| 725 |
// ki ten
|
| 726 |
-
Thread.sleep(2000);
|
| 727 |
-
GuiPacket(ss, "60701", null);
|
| 728 |
-
Thread.sleep(5000);
|
| 729 |
-
GuiPacket(ss, "60702", null);
|
| 730 |
-
Thread.sleep(5000);
|
| 731 |
-
GuiPacket(ss, "60703", null);
|
| 732 |
|
| 733 |
} catch (Exception e) {
|
| 734 |
System.out.println("NhanThuong " + ss.getUserId() + e.getMessage());
|
|
@@ -1242,7 +1242,7 @@ public class Worker extends Thread {
|
|
| 1242 |
StringBuilder rs = GuiPacket(ss, "62007", list1);
|
| 1243 |
Thread.sleep(5000);
|
| 1244 |
if (rs != null) {
|
| 1245 |
-
if (!rs.toString().contains("
|
| 1246 |
Tqtk.sendMessage("gian khoan " + ss.getUserId());
|
| 1247 |
// bat dau khoan
|
| 1248 |
GuiPacket(ss, "62006", list2);
|
|
@@ -1492,6 +1492,17 @@ public class Worker extends Thread {
|
|
| 1492 |
}
|
| 1493 |
session.setSocket(socket);
|
| 1494 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1495 |
|
| 1496 |
public static void createSocketApi(SessionEntity session) throws Exception {
|
| 1497 |
Socket socket1 = new Socket();
|
|
@@ -1521,7 +1532,7 @@ public class Worker extends Thread {
|
|
| 1521 |
NangNha();
|
| 1522 |
NangKiNang();
|
| 1523 |
NhanThuong();
|
| 1524 |
-
|
| 1525 |
// FarmDoLv60();
|
| 1526 |
// ThuThue();
|
| 1527 |
|
|
|
|
| 699 |
GuiPacket(ss, "12302", null);
|
| 700 |
|
| 701 |
// event mo ruong
|
| 702 |
+
//Thread.sleep(5000);
|
| 703 |
+
//GuiPacket(ss, "48113", list1);
|
| 704 |
|
| 705 |
// nhiem vu thuong ngay
|
| 706 |
Thread.sleep(5000);
|
|
|
|
| 723 |
Thread.sleep(2000);
|
| 724 |
GuiPacket(ss, "49007", list1);
|
| 725 |
// ki ten
|
| 726 |
+
//Thread.sleep(2000);
|
| 727 |
+
//GuiPacket(ss, "60701", null);
|
| 728 |
+
//Thread.sleep(5000);
|
| 729 |
+
//GuiPacket(ss, "60702", null);
|
| 730 |
+
//Thread.sleep(5000);
|
| 731 |
+
//GuiPacket(ss, "60703", null);
|
| 732 |
|
| 733 |
} catch (Exception e) {
|
| 734 |
System.out.println("NhanThuong " + ss.getUserId() + e.getMessage());
|
|
|
|
| 1242 |
StringBuilder rs = GuiPacket(ss, "62007", list1);
|
| 1243 |
Thread.sleep(5000);
|
| 1244 |
if (rs != null) {
|
| 1245 |
+
if (!rs.toString().contains("掘削中です")) {
|
| 1246 |
Tqtk.sendMessage("gian khoan " + ss.getUserId());
|
| 1247 |
// bat dau khoan
|
| 1248 |
GuiPacket(ss, "62006", list2);
|
|
|
|
| 1492 |
}
|
| 1493 |
session.setSocket(socket);
|
| 1494 |
}
|
| 1495 |
+
|
| 1496 |
+
public void createSocket1(SessionEntity session) throws Exception {
|
| 1497 |
+
Socket socket = new Socket();
|
| 1498 |
+
socket.connect(new InetSocketAddress(InetAddress.getByName(session.getIp()), Integer.parseInt(session.getPort())), 7000);
|
| 1499 |
+
socket.setSoTimeout(350000);
|
| 1500 |
+
try {
|
| 1501 |
+
session.getSocket().close();
|
| 1502 |
+
} catch (Exception e) {
|
| 1503 |
+
}
|
| 1504 |
+
session.setSocket(socket);
|
| 1505 |
+
}
|
| 1506 |
|
| 1507 |
public static void createSocketApi(SessionEntity session) throws Exception {
|
| 1508 |
Socket socket1 = new Socket();
|
|
|
|
| 1532 |
NangNha();
|
| 1533 |
NangKiNang();
|
| 1534 |
NhanThuong();
|
| 1535 |
+
GianKhoan();
|
| 1536 |
// FarmDoLv60();
|
| 1537 |
// ThuThue();
|
| 1538 |
|
src/main/java/tqtk/XuLy/XuLyPacket.java
CHANGED
|
@@ -71,11 +71,7 @@ public class XuLyPacket {
|
|
| 71 |
return rp;
|
| 72 |
} catch (Exception e) {
|
| 73 |
System.out.println(e.getMessage());
|
| 74 |
-
|
| 75 |
-
Worker.createSocket(ss);
|
| 76 |
-
}catch(Exception e1){
|
| 77 |
-
|
| 78 |
-
}
|
| 79 |
|
| 80 |
return null;
|
| 81 |
}
|
|
|
|
| 71 |
return rp;
|
| 72 |
} catch (Exception e) {
|
| 73 |
System.out.println(e.getMessage());
|
| 74 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
return null;
|
| 77 |
}
|
truyna.properties
CHANGED
|
@@ -1 +1 @@
|
|
| 1 |
-
|
|
|
|
| 1 |
+
|