修复通知时间会卡主的问题
修复重复获取路由器状态问题
This commit is contained in:
parent
7b1050b4e3
commit
e2432b5942
@ -6,8 +6,9 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class QQBotApplication {
|
public class QQBotApplication {
|
||||||
public static final String version="QQBot v.1.2.0";
|
public static final String version="QQBot v.1.2.1";
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
System.out.println("version = " + version);
|
||||||
SpringApplication.run(QQBotApplication.class, args);
|
SpringApplication.run(QQBotApplication.class, args);
|
||||||
RedisTools.initRedisPoolSub();
|
RedisTools.initRedisPoolSub();
|
||||||
QQBotManager.getInstance();
|
QQBotManager.getInstance();
|
||||||
|
@ -39,10 +39,14 @@ public class MiRouter extends Model {
|
|||||||
QQBotManager.getInstance().sendMessage(qq,"点击该删除设备:\n"+url);
|
QQBotManager.getInstance().sendMessage(qq,"点击该删除设备:\n"+url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private static boolean isRunTime=false;
|
||||||
@Override
|
@Override
|
||||||
public void onTime(String time) {
|
public void onTime(String time) {
|
||||||
super.onTime(time);
|
super.onTime(time);
|
||||||
|
if(isRunTime){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isRunTime=true;
|
||||||
String url = XiaoMiRouter.getDeviceListUrl();
|
String url = XiaoMiRouter.getDeviceListUrl();
|
||||||
JSONObject json = JSONObject.parseObject(HttpTools.get(url));
|
JSONObject json = JSONObject.parseObject(HttpTools.get(url));
|
||||||
if (json.getInteger("code") == 0) {
|
if (json.getInteger("code") == 0) {
|
||||||
@ -91,7 +95,7 @@ public class MiRouter extends Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
RedisTools.set(redis_key, devs.toJSONString());
|
RedisTools.set(redis_key, devs.toJSONString());
|
||||||
|
isRunTime=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,19 +23,21 @@ public class ApplicationInit implements ApplicationRunner {
|
|||||||
if (time.equals(oldTime)) {
|
if (time.equals(oldTime)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
oldTime=time;
|
oldTime = time;
|
||||||
for (Class<?> model : Model.classList) {
|
for (Class<?> model : Model.classList) {
|
||||||
try {
|
new Thread(() -> {
|
||||||
Model useModel= (Model) model.getDeclaredConstructor().newInstance();
|
try {
|
||||||
useModel.onTime(time);
|
Model useModel = (Model) model.getDeclaredConstructor().newInstance();
|
||||||
} catch (Exception e) {
|
useModel.onTime(time);
|
||||||
e.printStackTrace();
|
} catch (Exception e) {
|
||||||
}
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},0, 1000);
|
}, 0, 300);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user