From 760720a96c93a19112b2ac79ee1b7b13051e2cf0 Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Sat, 16 Jul 2022 21:06:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=B8=B4=E6=97=B6rss?= =?UTF-8?q?=E6=B2=A1=E5=AE=9A=E4=B9=89=E6=A0=87=E9=A2=98=E5=92=8C=E5=AD=A3?= =?UTF-8?q?=E5=BA=A6=E5=AF=BC=E8=87=B4=E6=97=A0=E6=B3=95=E6=90=9C=E5=88=AE?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/bangumi/AnimationController.java | 2 +- .../tools/services/BangumiServiceImpl.java | 6 +-- web/html/body/nas/animrss.html | 51 ++++++++++++++----- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/main/java/com/yutou/tools/bangumi/AnimationController.java b/src/main/java/com/yutou/tools/bangumi/AnimationController.java index 25b8985..817f57c 100644 --- a/src/main/java/com/yutou/tools/bangumi/AnimationController.java +++ b/src/main/java/com/yutou/tools/bangumi/AnimationController.java @@ -89,7 +89,7 @@ public class AnimationController { BangumiItem item = new BangumiItem(); item.setId(-1); item.setTitle(title); - item.setTitlekey(title.split("\\?")[1]); + item.setTitlekey(titleKey); i = bangumiService.addBangumiItem(item); json.put("msg", i == 0 ? "添加失败" : "添加成功"); return json; diff --git a/src/main/java/com/yutou/tools/services/BangumiServiceImpl.java b/src/main/java/com/yutou/tools/services/BangumiServiceImpl.java index f518029..29f7bea 100644 --- a/src/main/java/com/yutou/tools/services/BangumiServiceImpl.java +++ b/src/main/java/com/yutou/tools/services/BangumiServiceImpl.java @@ -1,5 +1,6 @@ package com.yutou.tools.services; +import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSONObject; import com.yutou.tools.mybatis.dao.BangumiItemDao; import com.yutou.tools.mybatis.dao.BangumiListDao; @@ -39,7 +40,7 @@ public class BangumiServiceImpl implements BangumiService { public int addBangumiItem(BangumiItem... list) { for (BangumiItem item : list) { if (item.getId().equals(-1)) { - RedisTools.list_add("anim_tmp_rss",item.getTitle()); + RedisTools.list_add("anim_tmp_rss", JSON.toJSON(item).toString()); } else if (itemDao.insert(item) <= 0) { return 0; } @@ -77,8 +78,7 @@ public class BangumiServiceImpl implements BangumiService { Set strings = RedisTools.list_get("anim_tmp_rss"); items=new ArrayList<>(); for (String string : strings) { - BangumiItem item=new BangumiItem();; - item.setTitle(string); + BangumiItem item=JSON.parseObject(string, BangumiItem.class); items.add(item); } return items; diff --git a/web/html/body/nas/animrss.html b/web/html/body/nas/animrss.html index a957090..b9eea5b 100644 --- a/web/html/body/nas/animrss.html +++ b/web/html/body/nas/animrss.html @@ -208,20 +208,43 @@ } }) function addTmpRss(def) { - layer.prompt({ - formType: 0, - value: '', - title: '请输入RSS地址' - }, function(value, index, elem){ - $.post('/anim/rss/add.do',{ - title: value, - bid:-1 - },function (json) { - console.log(json) - layer.msg(json.msg) - layer.close(index); - }) - }); + let option = ''; + for (let i = 0; i < 20; i++) { + if (i === 1) { + option += '' + } else { + option += '' + } + } + let html = '
标题:
URL: 季度:
' + layer.open({ + type: 0, + area: ['500px', '600px'], + title: '请输入RSS地址', + content: html, + success: function () { + layui.use(['form'], function () { + layui.form.render('select'); + }) + }, + cancel :function (index){ + layer.close(index) + }, + yes: function (index, elem) { + let url = $('#rss_value')[0].value + let title = $('#anim_rss_title')[0].value+ '/Season ' + $('#rss_select')[0].value + + $.post("/anim/rss/add.do", { + title: url + , titleKey: title + , bid: -1 + }, function (json) { + layer.msg(json.msg) + layer.close(index) + }) + } + }) + } layui.use(['layer', 'form', 'element', 'table', 'util'], function () { let layer = layui.layer