diff --git a/src/main/java/com/yutou/qqbot/QQBotApplication.java b/src/main/java/com/yutou/qqbot/QQBotApplication.java index 38e025a..f225b0f 100644 --- a/src/main/java/com/yutou/qqbot/QQBotApplication.java +++ b/src/main/java/com/yutou/qqbot/QQBotApplication.java @@ -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(); diff --git a/src/main/java/com/yutou/qqbot/models/XiaoMi/MiRouter.java b/src/main/java/com/yutou/qqbot/models/XiaoMi/MiRouter.java index b3a4455..a2d368c 100644 --- a/src/main/java/com/yutou/qqbot/models/XiaoMi/MiRouter.java +++ b/src/main/java/com/yutou/qqbot/models/XiaoMi/MiRouter.java @@ -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; } } diff --git a/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java b/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java index e559c6c..6da4736 100644 --- a/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java +++ b/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java @@ -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); } }