新增QQ启动前检查签名服务器是否运行
This commit is contained in:
parent
e65eb62417
commit
8da7c2f572
@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class QQBotApplication {
|
||||
public static final String version="QQBot v.1.5";
|
||||
public static final String version="QQBot v.1.5.1";
|
||||
public static void main(String[] args) {
|
||||
System.out.println("version = " + version);
|
||||
SpringApplication.run(QQBotApplication.class, args);
|
||||
|
@ -42,8 +42,30 @@ public class QQBotManager {
|
||||
|
||||
private void init() {
|
||||
new Thread(new Runnable() {
|
||||
private void reset() {
|
||||
try {
|
||||
Log.i("QQBot","签名加密服务未启动,1分钟后重试");
|
||||
Thread.sleep(60 * 1000);
|
||||
init();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
String test = HttpTools.get("http://192.168.31.88:7400/");
|
||||
try {
|
||||
JSONObject json = JSONObject.parseObject(test);
|
||||
if (json.getInteger("code") != 0) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
reset();
|
||||
return;
|
||||
}
|
||||
long qq = ConfigTools.load(ConfigTools.CONFIG, "qq_number", Long.class);
|
||||
String password = ConfigTools.load(ConfigTools.CONFIG, "qq_password", String.class);
|
||||
System.out.println("qq = " + qq);
|
||||
|
Loading…
Reference in New Issue
Block a user