mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
优化WEB端,可以使用回车直接发送弹幕;爬虫优化
This commit is contained in:
parent
c30fb7965a
commit
95149646f6
File diff suppressed because it is too large
Load Diff
@ -35,8 +35,8 @@ spring:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
username: books
|
||||
password: books
|
||||
#password:
|
||||
initialSize: 1
|
||||
minIdle: 3
|
||||
|
10
novel-admin/src/main/resources/crawl.properties
Normal file
10
novel-admin/src/main/resources/crawl.properties
Normal file
@ -0,0 +1,10 @@
|
||||
#爬虫线程数
|
||||
threadCount=1
|
||||
#爬取优先级 1:评分优先 2:更新时间优先
|
||||
priority=1
|
||||
#小说最低评分,0表示不限制
|
||||
lowestScore=0
|
||||
#小说最小更新时间
|
||||
minUptTime=2000-01-01 00:00:00
|
||||
#爬取最大条数,0表示不限制
|
||||
maxNumber=0
|
@ -159,14 +159,15 @@ function detail(id) {
|
||||
});
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
function edit(){
|
||||
console.log('打开配置页面');
|
||||
layer.open({
|
||||
type: 2,
|
||||
title: '编辑',
|
||||
maxmin: true,
|
||||
shadeClose: false, // 点击遮罩关闭层
|
||||
area: ['800px', '520px'],
|
||||
content: prefix + '/edit/' + id // iframe的url
|
||||
type : 2,
|
||||
title : '增加',
|
||||
maxmin : true,
|
||||
shadeClose : false,
|
||||
area : [ '800px', '520px' ],
|
||||
content : prefix + '/edit'
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -9,14 +9,9 @@
|
||||
<div class="ibox-body">
|
||||
<div class="fixed-table-toolbar">
|
||||
<div class="columns pull-left">
|
||||
<button shiro:hasPermission="books:bookCrawl:add" type="button"
|
||||
class="btn btn-primary" onclick="add()">
|
||||
<i class="fa fa-plus" aria-hidden="true"></i>添加
|
||||
</button>
|
||||
<button shiro:hasPermission="books:bookCrawl:batchRemove" type="button"
|
||||
class="btn btn-danger"
|
||||
onclick="batchRemove()">
|
||||
<i class="fa fa-trash" aria-hidden="true"></i>删除
|
||||
<button type="button" class="btn btn-info"
|
||||
onclick="edit()">
|
||||
<i class="" aria-hidden="true"></i>爬虫配置
|
||||
</button>
|
||||
</div>
|
||||
<div class="columns pull-right">
|
||||
|
@ -1,5 +1,5 @@
|
||||
server:
|
||||
port: 80
|
||||
port: 8080
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
|
@ -309,35 +309,16 @@
|
||||
// 弹幕定时器
|
||||
var timers = [];
|
||||
// 控制弹幕显隐变量
|
||||
//监听键盘事件
|
||||
$("#screenBulletText").keypress(function (even) {
|
||||
if (even.which == 13) {
|
||||
//enter键按下
|
||||
sendBullet();
|
||||
}
|
||||
});
|
||||
// 监听发送按钮
|
||||
$(".send").on("click", function () {
|
||||
var bullet = $("#screenBulletText").val();
|
||||
var contentId = $("#contentIdHidden").val();
|
||||
if (bullet && contentId) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/book/sendBullet",
|
||||
contentType: 'application/x-www-form-urlencoded;charset=utf-8',
|
||||
data: {contentId: contentId, bullet: bullet},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var bullet = $("#screenBulletText").val("")
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
layer.alert("发送失败");
|
||||
return;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.alert("发送内容不能为空");
|
||||
return;
|
||||
}
|
||||
// 创建弹幕
|
||||
var jqueryDom = createScreenbullet(bullet);
|
||||
// 添加定时任务
|
||||
addInterval(jqueryDom);
|
||||
sendBullet();
|
||||
});
|
||||
// 监听关闭弹幕按钮
|
||||
$("[lay-skin='_switch']").click(function () {
|
||||
@ -488,6 +469,36 @@
|
||||
while(true) if(new Date().getTime()-start > n) break;
|
||||
|
||||
}
|
||||
//发送弹幕
|
||||
function sendBullet(){
|
||||
var bullet = $("#screenBulletText").val();
|
||||
var contentId = $("#contentIdHidden").val();
|
||||
if (bullet && contentId) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/book/sendBullet",
|
||||
contentType: 'application/x-www-form-urlencoded;charset=utf-8',
|
||||
data: {contentId: contentId, bullet: bullet},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
var bullet = $("#screenBulletText").val("")
|
||||
},
|
||||
error: function (e) {
|
||||
console.log(e);
|
||||
layer.alert("发送失败");
|
||||
return;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
layer.alert("发送内容不能为空");
|
||||
return;
|
||||
}
|
||||
// 创建弹幕
|
||||
var jqueryDom = createScreenbullet(bullet);
|
||||
// 添加定时任务
|
||||
addInterval(jqueryDom);
|
||||
}
|
||||
</script>
|
||||
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user