diff --git a/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java b/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java index 2d4a9c6..9ac4202 100644 --- a/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java +++ b/src/main/java/com/yutou/qqbot/models/setu/GetSeTu.java @@ -43,7 +43,7 @@ public class GetSeTu extends Model { if ("00:00:00".equals(time)) { del(); } else if (RedisTools.get("Setu_time", "23:59:00").equals(time)) { - send(); + send(qq); } } @@ -57,62 +57,56 @@ public class GetSeTu extends Model { redis.close(); } - private void send() { + private void send(Long group) { Jedis redis = RedisTools.getRedis(); redis.select(RedisTools.QQBOT_USER); - Set keys = redis.keys("Setu_*"); - Log.i("进入涩图打印:" + keys.size()); + String key = redis.get("Setu_"+group); redis.close(); - for (String key : keys) { - if ("Setu_time".equals(key)) { - continue; + String ret = RedisTools.get(key); + MessageChainBuilder builder = null; + Log.i(key, ret); + if (!StringUtils.isEmpty(ret)) { + JSONArray array = JSONArray.parseArray(ret); + builder = new MessageChainBuilder(); + builder.append("各位老色胚们晚上好,现在公布本群涩图数据!"); + builder.append("\n"); + builder.append("本群今日共查询:"); + builder.append(String.valueOf(array.size())); + builder.append("次!\n"); + builder.append("接下来公布大伙的XP系统:"); + builder.append("\n"); + Map> map = new HashMap<>(); + for (Object o : array) { + JSONObject item = (JSONObject) o; + List tags = map.getOrDefault(item.getLong("user"), new ArrayList<>()); + tags.add(item.getString("key")); + map.put(item.getLong("user"), tags); } - String ret = RedisTools.get(key); - MessageChainBuilder builder = null; - Log.i(key, ret); - if (!StringUtils.isEmpty(ret)) { - JSONArray array = JSONArray.parseArray(ret); - builder = new MessageChainBuilder(); - builder.append("各位老色胚们晚上好,现在公布本群涩图数据!"); - builder.append("\n"); - builder.append("本群今日共查询:"); - builder.append(String.valueOf(array.size())); - builder.append("次!\n"); - builder.append("接下来公布大伙的XP系统:"); - builder.append("\n"); - Map> map = new HashMap<>(); - for (Object o : array) { - JSONObject item = (JSONObject) o; - List tags = map.getOrDefault(item.getLong("user"), new ArrayList<>()); - tags.add(item.getString("key")); - map.put(item.getLong("user"), tags); + Long maxQQ = -1L; + int max = -1; + for (Long qq : map.keySet()) { + builder.append("------------------\n"); + List list = map.get(qq); + if (list.size() > max) { + max = list.size(); + maxQQ = qq; } - Long maxQQ = -1L; - int max = -1; - for (Long qq : map.keySet()) { - builder.append("------------------\n"); - List list = map.get(qq); - if (list.size() > max) { - max = list.size(); - maxQQ = qq; - } - builder.append(new At(qq)) - .append(":\n"); - for (String tag : list) { - builder.append(tag).append("\n"); - } - builder.append("------------------\n"); + builder.append(new At(qq)) + .append(":\n"); + for (String tag : list) { + builder.append(tag).append("\n"); } - builder.append("那么今日最色批的就是:"); - builder.append(new At(maxQQ)); - builder.append("\n"); - builder.append("如果炸群了请找他(\n"); - builder.append("明天见~"); - } - Log.i("打印色图统计:" + builder); - if (builder != null) { - QQBotManager.getInstance().sendMessage(Long.parseLong(key.replace("Setu_", "")), builder); + builder.append("------------------\n"); } + builder.append("那么今日最色批的就是:"); + builder.append(new At(maxQQ)); + builder.append("\n"); + builder.append("如果炸群了请找他(\n"); + builder.append("明天见~"); + } + Log.i("打印色图统计:" + builder); + if (builder != null) { + QQBotManager.getInstance().sendMessage(Long.parseLong(key.replace("Setu_", "")), builder); } } diff --git a/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java b/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java index b4cdc7e..2e56aa6 100644 --- a/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java +++ b/src/main/java/com/yutou/qqbot/utlis/ApplicationInit.java @@ -29,7 +29,6 @@ public class ApplicationInit implements ApplicationRunner { return; } oldTime = time; - Log.i("ApplicationInit run > "+oldTime ); for (Class model : Model.classList) { new Thread(() -> { try {