fix:优化rss加载时间问题

fix:rss页面今日动画无图片时无法展示的问题
del:移除redis的一处print
This commit is contained in:
Yutousama 2022-07-14 13:09:17 +08:00
parent 96b2ba371f
commit 3fb9220e72
4 changed files with 12 additions and 6 deletions

View File

@ -6,7 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class ToolsApplication { public class ToolsApplication {
public static final String version="1.4.6"; public static final String version="1.4.7";
public static void main(String[] args) { public static void main(String[] args) {
System.out.println("当前版本号:" + version); System.out.println("当前版本号:" + version);

View File

@ -9,6 +9,7 @@ import com.yutou.tools.mybatis.model.BangumiList;
import com.yutou.tools.mybatis.model.BangumiListExample; import com.yutou.tools.mybatis.model.BangumiListExample;
import com.yutou.tools.services.interfaces.BangumiService; import com.yutou.tools.services.interfaces.BangumiService;
import com.yutou.tools.utils.BangumiTools; import com.yutou.tools.utils.BangumiTools;
import com.yutou.tools.utils.RedisTools;
import com.yutou.tools.utils.Tools; import com.yutou.tools.utils.Tools;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -74,7 +75,9 @@ public class BangumiServiceImpl implements BangumiService {
if(item.getEnable()==0||item.getBgmid()==0){ if(item.getEnable()==0||item.getBgmid()==0){
continue; continue;
} }
JSONObject bangumi=BangumiTools.getBangumiInfoSmall(item.getBgmid()); String tmp=RedisTools.get(item.getBgmid()+"",1);
JSONObject bangumi= tmp==null?BangumiTools.getBangumiInfoSmall(item.getBgmid()):JSONObject.parseObject(tmp);
RedisTools.set(1,item.getBgmid()+"",bangumi.toJSONString());
if(bangumi.containsKey("code")&&bangumi.getInteger("code")==404){ if(bangumi.containsKey("code")&&bangumi.getInteger("code")==404){
continue; continue;
} }

View File

@ -42,7 +42,6 @@ public class RedisTools {
Jedis jedis = getRedis(); Jedis jedis = getRedis();
jedis.select(dbIndex); jedis.select(dbIndex);
String ret = jedis.set(key, value); String ret = jedis.set(key, value);
System.out.println("Redis set =" + ret);
jedis.close(); jedis.close();
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
@ -77,9 +76,9 @@ public class RedisTools {
} }
public static String get(String key, int dbIndex) { public static String get(String key, int dbIndex) {
String value = "-999"; String value = null;
if (isNotInstallRedis) { if (isNotInstallRedis) {
return value; return null;
} }
try (Jedis jedis = getRedis()) { try (Jedis jedis = getRedis()) {
jedis.select(dbIndex); jedis.select(dbIndex);

View File

@ -433,7 +433,11 @@
if (name === '') { if (name === '') {
name = item.name; name = item.name;
} }
html += '<tr><td>' + name + '</td><td>' + item.air_date + '</td><td><img src="' + item.images.small + '"></td><td><a href="' + item.url + '" target="_blank">前往番剧计划</a></td></tr>' let img='#'
if(item.images!=null){
img=item.images.small
}
html += '<tr><td>' + name + '</td><td>' + item.air_date + '</td><td><img src="' + img + '"></td><td><a href="' + item.url + '" target="_blank">前往番剧计划</a></td></tr>'
_tab.push({title: item.name, url: '<a href="' + item.url + '">前往番剧计划</a>'}) _tab.push({title: item.name, url: '<a href="' + item.url + '">前往番剧计划</a>'})
}) })
html += "</table>" html += "</table>"