add:新增今日动画按钮

This commit is contained in:
Yutousama 2022-07-10 18:24:17 +08:00
parent 25730638a3
commit f57325c327
3 changed files with 44 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import com.yutou.tools.mybatis.model.BangumiItemExample;
import com.yutou.tools.mybatis.model.BangumiList;
import com.yutou.tools.mybatis.model.BangumiListExample;
import com.yutou.tools.services.interfaces.BangumiService;
import com.yutou.tools.utils.BangumiTools;
import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
@ -166,4 +167,9 @@ public class AnimationController {
JSONArray array= (JSONArray) JSON.toJSON(list);
return array.toJSONString();
}
@ResponseBody
@RequestMapping(value = "/anim/getToDay.do", method = RequestMethod.GET)
public JSONObject getToDayAnim(){
return BangumiTools.getBangumi(0);
}
}

View File

@ -75,7 +75,7 @@ public class BangumiServiceImpl implements BangumiService {
continue;
}
JSONObject bangumi=BangumiTools.getBangumiInfoSmall(item.getBgmid());
if(bangumi.getInteger("code")==404){
if(bangumi.containsKey("code")&&bangumi.getInteger("code")==404){
continue;
}
int day=Tools.getWeekDay();

View File

@ -203,11 +203,23 @@
}
})
layui.use(['layer', 'form', 'element', 'table'], function () {
layui.use(['layer', 'form', 'element', 'table', 'util'], function () {
let layer = layui.layer
, util = layui.util
, form = layui.form
, table = layui.table
, element = layui.element;
util.fixbar({
bar1: '',
bgcolor: '#393D49',
css: {right: 100, bottom: 100},
click: function(type){
console.log(type);
if(type === 'bar1'){
showToDayAnim()
}
}
});
$.get("/anim/type/list.do", function (data) {
let json = JSON.parse(data);
if (json.code === 0) {
@ -411,6 +423,30 @@
}
function showToDayAnim() {
$.get("/anim/getToDay.do", function (json) {
let items = json.items;
let _tab = []
let html = '<table class="layui-table"> <colgroup> <col width="150" /> <col width="200" /> <col /> </colgroup> <thead> <tr> <th>标题</th> <th>首更时间</th> <th>图片</th> <th>地址</th> </tr> </thead> <tbody> </tbody>'
items.forEach((item) => {
let name = item.name_cn
if (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>'
_tab.push({title: item.name, url: '<a href="' + item.url + '">前往番剧计划</a>'})
})
html += "</table>"
layer.open({
title: '今日新番列表',
area: ['700px', '300px'],
content: html,
shade: 0,
offset: 'rb'
});
})
}
});
@ -420,7 +456,6 @@
$('#bgmUrl')[0].href = url;
}
//let js="" ; $('#team option').each(function() { let value=$(this).val(); let text=$(this).text(); js+='{"'+value+'":"'+text+'"},'})
</script>
</body>
<style>