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