From 45ce18edac84671d2a702795b9380f5640232b0b Mon Sep 17 00:00:00 2001 From: yutou Date: Mon, 18 Jan 2021 18:16:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DRedis=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/yutou/tools/ToolsApplication.java | 2 +- .../java/com/yutou/tools/bangumi/BangumiTools.java | 2 +- src/main/java/com/yutou/tools/other/tools.java | 2 +- src/main/java/com/yutou/tools/utils/RedisTools.java | 10 +--------- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/yutou/tools/ToolsApplication.java b/src/main/java/com/yutou/tools/ToolsApplication.java index 948edf5..30e6595 100644 --- a/src/main/java/com/yutou/tools/ToolsApplication.java +++ b/src/main/java/com/yutou/tools/ToolsApplication.java @@ -9,7 +9,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToolsApplication { - public static final String version="1.0.15.03"; + public static final String version="1.0.15.04"; public static void main(String[] args) { System.out.println("当前版本号:"+version); diff --git a/src/main/java/com/yutou/tools/bangumi/BangumiTools.java b/src/main/java/com/yutou/tools/bangumi/BangumiTools.java index dbfcc18..7db1e54 100644 --- a/src/main/java/com/yutou/tools/bangumi/BangumiTools.java +++ b/src/main/java/com/yutou/tools/bangumi/BangumiTools.java @@ -248,7 +248,7 @@ public class BangumiTools { */ public static String reportToDayBangumi() { String toDayTime = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); - if (!RedisTools.get("reportToDayBangumi").equals(toDayTime)) { + if (!toDayTime.equals(RedisTools.get("reportToDayBangumi"))) { RedisTools.set("reportToDayBangumi", toDayTime); StringBuilder builder = new StringBuilder(); JSONObject toDay = getBangumi(0); diff --git a/src/main/java/com/yutou/tools/other/tools.java b/src/main/java/com/yutou/tools/other/tools.java index d7fb244..1da0a32 100644 --- a/src/main/java/com/yutou/tools/other/tools.java +++ b/src/main/java/com/yutou/tools/other/tools.java @@ -80,7 +80,7 @@ public class tools { json.put("params", params); json.put("cookie", cookies); json.put("header", header); - Tools.sendServer("打印请求", json.toJSONString()); + //Tools.sendServer("打印请求", json.toJSONString()); try { switch (RedisTools.get("request")){ case "success": diff --git a/src/main/java/com/yutou/tools/utils/RedisTools.java b/src/main/java/com/yutou/tools/utils/RedisTools.java index 8e7bd86..04a700c 100644 --- a/src/main/java/com/yutou/tools/utils/RedisTools.java +++ b/src/main/java/com/yutou/tools/utils/RedisTools.java @@ -80,21 +80,13 @@ public class RedisTools { if (isNotInstallRedis) { return value; } - Jedis jedis = null; - try { - jedis = getRedis(); + try (Jedis jedis = getRedis()) { jedis.select(dbIndex); value = jedis.get(key); jedis.close(); } catch (Exception e) { // TODO: handle exception // e.printStackTrace(); - } finally { - if (jedis != null) - jedis.close(); - } - if(value==null){ - value="-999"; } return value; }