From 3e199749f6ae466d80e5f020a7dee945db52e595 Mon Sep 17 00:00:00 2001 From: yutou Date: Mon, 24 May 2021 13:47:45 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E6=AF=8F=E6=97=A5=E7=95=AA=E5=89=A7?= =?UTF-8?q?=E5=9C=B0=E5=9D=80=E5=8F=98=E5=8A=A8=20add=20=E6=B6=A9=E5=9B=BE?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/yutou/nas/bangumi/BangumiTools.java | 14 +++++++++----- src/main/java/com/yutou/nas/other/QQSetu.java | 6 +++++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/yutou/nas/bangumi/BangumiTools.java b/src/main/java/com/yutou/nas/bangumi/BangumiTools.java index 51ffa13..ad0971d 100644 --- a/src/main/java/com/yutou/nas/bangumi/BangumiTools.java +++ b/src/main/java/com/yutou/nas/bangumi/BangumiTools.java @@ -12,7 +12,7 @@ import java.text.SimpleDateFormat; import java.util.*; public class BangumiTools { - private static final String url = "http://api.bgm.tv/"; + private static final String url = "https://api.bgm.tv/"; private static final String toDayBangumi = url + "calendar"; private static final String BangumiInfo = url + "/subject/%s?responseGroup=large"; private static final String SearchBangumi = url + "/search/subject/%s?responseGroup=large"; @@ -41,13 +41,14 @@ public class BangumiTools { day = 7; } } - if (main != null) + if (main != null) { for (Object o : main) { JSONObject json = (JSONObject) o; if (json.getJSONObject("weekday").getInteger("id") == day) { return json; } } + } return null; } @@ -268,6 +269,7 @@ public class BangumiTools { RedisTools.set("toDayBangumi", builder.toString()); return builder.toString(); } else { + System.out.println("error "); return RedisTools.get("toDayBangumi"); } } @@ -312,8 +314,9 @@ public class BangumiTools { } builder.append("类型:").append(type).append("\n"); builder.append("id:").append(item.getInteger("id")).append("\n"); - if (item.containsKey("rating")) + if (item.containsKey("rating")) { builder.append("Bangumi评分:").append(item.getJSONObject("rating").getFloat("score")).append("\n"); + } builder.append("首播时间:").append(item.getString("air_date")).append("\n"); builder.append("每周 ").append(item.getInteger("air_weekday")).append(" 放送").append("\n"); builder.append("放送集数:").append(item.getInteger("eps")).append("\n"); @@ -330,8 +333,9 @@ public class BangumiTools { } public static void main(String[] args) { - String str = reportBangumiList(); - com.yutou.nas.utils.Log.i(str); + RedisTools.remove("reportToDayBangumi"); + String str = reportToDayBangumi(); + System.out.println(str); } } diff --git a/src/main/java/com/yutou/nas/other/QQSetu.java b/src/main/java/com/yutou/nas/other/QQSetu.java index e77e713..f56607c 100644 --- a/src/main/java/com/yutou/nas/other/QQSetu.java +++ b/src/main/java/com/yutou/nas/other/QQSetu.java @@ -2,6 +2,7 @@ package com.yutou.nas.other; import com.alibaba.fastjson.JSONObject; +import com.yutou.nas.utils.Log; import com.yutou.nas.utils.QQBotManager; import com.yutou.nas.utils.RedisTools; import com.yutou.nas.utils.Tools; @@ -21,7 +22,7 @@ import java.util.TimerTask; public class QQSetu { public static void printTodaySetu() { String redisKey=Tools.getToDayTime() + "_setu"; - com.yutou.nas.utils.Log.i("redisKey = " + redisKey); + com.yutou.nas.utils.Log.i("今日涩图 redisKey = " + redisKey); String js = RedisTools.get(redisKey, 1); if (js != null) { JSONObject json = JSONObject.parseObject(js); @@ -56,8 +57,11 @@ public class QQSetu { builder.append("获得分数 ").append(String.valueOf(setu.getFloat("average"))).append("\n"); builder.append("共有 ").append(String.valueOf(score.getIntValue("userNumber"))).append(" 人参与投票"); QQBotManager.getInstance().sendMessage(info.getLong("group"),builder); + Log.i("今日涩图:"+builder.toString()); } } + }else { + Log.i("今日没有涩图"); } }