fix:修复临时rss没定义标题和季度导致无法搜刮的问题
This commit is contained in:
parent
ffb9c8f161
commit
760720a96c
@ -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;
|
||||
|
@ -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<String> 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;
|
||||
|
@ -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 += '<option selected>' + i + '</option>'
|
||||
} else {
|
||||
option += '<option>' + i + '</option>'
|
||||
}
|
||||
}
|
||||
let html = '<form class="layui-form">标题:<div class="layui-form-item"><input type="text" id="anim_rss_title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">URL:<textarea class="layui-textarea" id="rss_value""></textarea> 季度:<select lay-search lay-verify="required" id="rss_select">' + option + '</select> </div></form>'
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user