mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
新增小说容量配置
This commit is contained in:
parent
dc20ad42bd
commit
ccab7f01a2
@ -7,4 +7,5 @@ public class CacheKeyConstans {
|
|||||||
public static final String EMAIL_URL_PREFIX_KEY = "emailUrlPrefixKey";
|
public static final String EMAIL_URL_PREFIX_KEY = "emailUrlPrefixKey";
|
||||||
public static final String RANDOM_NEWS_CONTENT_KEY = "randomNewsContentKey";
|
public static final String RANDOM_NEWS_CONTENT_KEY = "randomNewsContentKey";
|
||||||
public static final String REC_BOOK_LIST_KEY = "recBookListKey";
|
public static final String REC_BOOK_LIST_KEY = "recBookListKey";
|
||||||
|
public static final String BOOK_NUMBER_KEY= "bookNumberKey";
|
||||||
}
|
}
|
||||||
|
@ -3,11 +3,13 @@ package xyz.zinglizingli.books.core.crawl;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import xyz.zinglizingli.books.core.utils.Constants;
|
import xyz.zinglizingli.books.core.utils.Constants;
|
||||||
import xyz.zinglizingli.books.mapper.BookParseLogMapper;
|
import xyz.zinglizingli.books.mapper.BookParseLogMapper;
|
||||||
import xyz.zinglizingli.books.po.*;
|
import xyz.zinglizingli.books.po.*;
|
||||||
import xyz.zinglizingli.books.service.BookService;
|
import xyz.zinglizingli.books.service.BookService;
|
||||||
import xyz.zinglizingli.books.core.utils.CatUtil;
|
import xyz.zinglizingli.books.core.utils.CatUtil;
|
||||||
|
import xyz.zinglizingli.common.cache.CommonCacheUtil;
|
||||||
import xyz.zinglizingli.common.utils.ExcutorUtils;
|
import xyz.zinglizingli.common.utils.ExcutorUtils;
|
||||||
import xyz.zinglizingli.common.utils.RestTemplateUtil;
|
import xyz.zinglizingli.common.utils.RestTemplateUtil;
|
||||||
|
|
||||||
@ -28,6 +30,12 @@ public class BiquCrawlSource extends BaseHtmlCrawlSource {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private BookService bookService;
|
private BookService bookService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CommonCacheUtil cacheUtil;
|
||||||
|
|
||||||
|
@Value("${books.maxNum}")
|
||||||
|
private Integer maxNumBooks;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parse() {
|
public void parse() {
|
||||||
|
|
||||||
@ -168,8 +176,11 @@ public class BiquCrawlSource extends BaseHtmlCrawlSource {
|
|||||||
|
|
||||||
//查询该书籍已存在目录号
|
//查询该书籍已存在目录号
|
||||||
Map<Integer, BookIndex> hasIndexs = bookService.queryIndexByBookNameAndAuthor(bookName, author);
|
Map<Integer, BookIndex> hasIndexs = bookService.queryIndexByBookNameAndAuthor(bookName, author);
|
||||||
|
//查询数据库书籍数量
|
||||||
|
long bookNumber = bookService.queryBookNumber();
|
||||||
|
|
||||||
//更新和插入分别开,此处只做更新
|
//更新和插入分别开,此处只做更新
|
||||||
if (hasIndexs.size() > 0) {
|
if (hasIndexs.size() > 0 || bookNumber < maxNumBooks) {
|
||||||
while (isFindIndex) {
|
while (isFindIndex) {
|
||||||
BookIndex hasIndex = hasIndexs.get(indexNum);
|
BookIndex hasIndex = hasIndexs.get(indexNum);
|
||||||
String indexName = indexListMatch.group(2);
|
String indexName = indexListMatch.group(2);
|
||||||
|
@ -517,4 +517,17 @@ public class BookService {
|
|||||||
bookParseLogMapper.deleteByPrimaryKey(id);
|
bookParseLogMapper.deleteByPrimaryKey(id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询数据库书籍数量
|
||||||
|
* */
|
||||||
|
public int queryBookNumber() {
|
||||||
|
|
||||||
|
Integer bookNumber = (Integer) cacheUtil.getObject(CacheKeyConstans.BOOK_NUMBER_KEY);
|
||||||
|
if(bookNumber == null){
|
||||||
|
bookNumber = bookMapper.countByExample(new BookExample());
|
||||||
|
cacheUtil.setObject(CacheKeyConstans.BOOK_NUMBER_KEY,bookNumber,60*5);
|
||||||
|
}
|
||||||
|
return bookNumber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,8 @@ books:
|
|||||||
lowestScore: 6.0
|
lowestScore: 6.0
|
||||||
#小说的更新间隔(分)
|
#小说的更新间隔(分)
|
||||||
updatePeriod: 1
|
updatePeriod: 1
|
||||||
|
#爬取小说数量
|
||||||
|
maxNum: 300000
|
||||||
|
|
||||||
#爬取的网站名称类型 1:笔趣岛 ,2:笔趣塔,3:顶点小说 ,4:百书斋 更多网站解析中,敬请期待
|
#爬取的网站名称类型 1:笔趣岛 ,2:笔趣塔,3:顶点小说 ,4:百书斋 更多网站解析中,敬请期待
|
||||||
crawl:
|
crawl:
|
||||||
|
283
novel-front/src/main/resources/templates/books/index.html
Normal file
283
novel-front/src/main/resources/templates/books/index.html
Normal file
@ -0,0 +1,283 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
|
||||||
|
<title>精品小说楼</title>
|
||||||
|
|
||||||
|
<meta name="keywords" content="精品小说楼,精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说">
|
||||||
|
|
||||||
|
<meta name="description"
|
||||||
|
content="精品小说楼是国内优秀的小说弹幕网站,精品小说楼提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。">
|
||||||
|
|
||||||
|
<meta property="og:type" content="novel_index"/>
|
||||||
|
<meta property="og:title" content="精品小说楼"/>
|
||||||
|
<meta property="og:description"
|
||||||
|
content="精品小说楼是国内优秀的小说弹幕网站,精品小说楼提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。"/>
|
||||||
|
|
||||||
|
<div th:include="common/css :: css"></div>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
|
||||||
|
.line-limit-length {
|
||||||
|
|
||||||
|
overflow: hidden;
|
||||||
|
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
|
||||||
|
white-space: nowrap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
.layui-nav .layui-nav-item {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
vertical-align: middle;
|
||||||
|
line-height: 50px;
|
||||||
|
}
|
||||||
|
|
||||||
|
body ul.layui-nav li.layui-nav-item a {
|
||||||
|
display: block;
|
||||||
|
transition: all .3s;
|
||||||
|
-webkit-transition: all .3s;
|
||||||
|
}
|
||||||
|
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
var _hmt = _hmt || [];
|
||||||
|
(function () {
|
||||||
|
var hm = document.createElement("script");
|
||||||
|
hm.src = "https://hm.baidu.com/hm.js?2cf01edbc2b27cd3a143e17948167d77";
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(hm, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 你的HTML代码 -->
|
||||||
|
<a name="top"></a>
|
||||||
|
<ul class="layui-nav" lay-filter="" style="padding:0 36px;text-align: center">
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=1">玄幻小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=2">修真小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=3">都市小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=4">历史小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=6">网游小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=5">科幻小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a href="/book/search?catId=7">女频小说</a></li>
|
||||||
|
<li class="layui-nav-item"><a>完本小说</a>
|
||||||
|
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
||||||
|
<dd><a href="/book/search?bookStatus=完成">全部小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=1">玄幻小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=2">修真小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=3">都市小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=4">历史小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=6">网游小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=5">科幻小说</a></dd>
|
||||||
|
<dd><a href="/book/search?bookStatus=完成&catId=7">女频小说</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
<li class="layui-nav-item"><a>小说排行</a>
|
||||||
|
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
||||||
|
<dd><a href="/book/search?sortBy=score">全部小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=1">玄幻小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=2">修真小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=3">都市小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=4">历史小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=6">网游小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=5">科幻小说</a></dd>
|
||||||
|
<dd><a href="/book/search?sortBy=score&catId=7">女频小说</a></dd>
|
||||||
|
</dl>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="layui-container">
|
||||||
|
<div class="layui-row">
|
||||||
|
|
||||||
|
<div class="layui-col-xs10 layui-col-sm10 layui-col-md11 layui-col-lg11" style="padding-top:1%">
|
||||||
|
<input id="title" type="text" name="title" required lay-verify="required" placeholder="请输入书名·作者"
|
||||||
|
autocomplete="off"
|
||||||
|
class="layui-input">
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-xs1" style="padding: 1%">
|
||||||
|
<button onclick="searchBooks()" class="layui-btn" lay-submit lay-filter="formDemo">搜索</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="layui-collapse">
|
||||||
|
<div class="layui-colla-item">
|
||||||
|
<h2 class="layui-colla-title">本站推荐</h2>
|
||||||
|
<div class="layui-colla-content layui-show">
|
||||||
|
|
||||||
|
|
||||||
|
<div class="layui-container" style="padding: 0px">
|
||||||
|
|
||||||
|
<div class="layui-row" style="text-align: center">
|
||||||
|
<span th:each="recBook : ${recBooks}">
|
||||||
|
<a th:href="'/book/' + ${recBook.id} + '.html'">
|
||||||
|
<div style="padding: 1%" class="layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
||||||
|
<img style=" width:80%; height:auto; max-width:100%; max-height:100%;"
|
||||||
|
th:src="${recBook.picUrl}"/>
|
||||||
|
<br/>
|
||||||
|
<span th:text="${recBook.bookName}"></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-colla-item">
|
||||||
|
<h2 class="layui-colla-title">热门小说推荐</h2>
|
||||||
|
<div class="layui-colla-content layui-show">
|
||||||
|
|
||||||
|
<div class="layui-container">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div style="margin-bottom: 5px" class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4"
|
||||||
|
th:each="hotBook : ${hotBooks}">
|
||||||
|
<a th:href="'/book/' + ${hotBook.id} + '.html'">
|
||||||
|
<div class="layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
||||||
|
<img style=" width:100px; height:125px;"
|
||||||
|
th:src="${hotBook.picUrl}"/>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-xs5 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
||||||
|
<ul>
|
||||||
|
<li class="line-limit-length" style="font-weight: bold"
|
||||||
|
th:text="${hotBook.bookName}"></li>
|
||||||
|
<li th:text="'作者:'+ ${hotBook.author}"></li>
|
||||||
|
<li style="width: 180px;height:40px;overflow: hidden"
|
||||||
|
th:text="'简介:'+ ${hotBook.bookDesc}"></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div style="font-style: italic;color: red"
|
||||||
|
class="layui-col-xs2 layui-col-sm2 layui-col-md2 layui-col-lg2"
|
||||||
|
th:text="${hotBook.score} + '分'"></div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!--<div th:each="hotBook : ${hotBooks}" style="margin-top: 1%"
|
||||||
|
class="layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
||||||
|
<a th:href="'/book/'+${hotBook.id}+'.html'">
|
||||||
|
<div class="layui-col-xs5 layui-col-sm3 layui-col-md3 layui-col-lg3">
|
||||||
|
<img style=" width:100px; height:125px;"
|
||||||
|
th:src="${hotBook.picUrl}"/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-col-xs7 layui-col-sm6 layui-col-md7 layui-col-lg7"
|
||||||
|
style="float: left;padding-right: 10px">
|
||||||
|
<div><b th:text="${hotBook.bookName}"></b></div>
|
||||||
|
<div class="layui-col-xs8 layui-col-sm9 layui-col-md10 layui-col-lg10"
|
||||||
|
th:text="'作者:'+ ${hotBook.author}"></div>
|
||||||
|
<div class="layui-col-xs3 layui-col-sm2 layui-col-md1 layui-col-lg1" style="text-align: right;">
|
||||||
|
<b><i style="color: red"
|
||||||
|
th:text="${hotBook.score} + '分'"></i></b></div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-elip layui-col-xs12 layui-col-sm9 layui-col-md10 layui-col-lg10 layui-col-sm9 layui-col-md10 layui-col-lg10"
|
||||||
|
th:text="${hotBook.bookDesc}">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</a>
|
||||||
|
</div>-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="layui-colla-item"><a href="javascript:moreNewBooks()">
|
||||||
|
<h2 class="layui-colla-title">最近更新小说
|
||||||
|
<div style="float: right; margin-right: 20px"><i style="font-size: 14px;"
|
||||||
|
class="layui-icon">更多</i>
|
||||||
|
</div>
|
||||||
|
</h2>
|
||||||
|
</a>
|
||||||
|
<div class="layui-colla-content layui-show">
|
||||||
|
|
||||||
|
<div class="layui-container" style="padding-left: 2px;padding-right: 5px">
|
||||||
|
<div class="layui-row">
|
||||||
|
<div th:each="newBook,bookStat : ${newBooks}" style="padding-bottom: 30px"
|
||||||
|
class="layui-col-xs12 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
||||||
|
|
||||||
|
<a th:href="'/book/'+${newBook.id}+'.html'">
|
||||||
|
<div class="line-limit-length layui-col-xs8 layui-col-sm6 layui-col-md6 layui-col-lg6"><b
|
||||||
|
th:text="${bookStat.index}+1+'.'+${newBook.bookName}"></b> - <span class="layui-elip"
|
||||||
|
th:text="${newBook.author}"></span>
|
||||||
|
</div>
|
||||||
|
<div class="layui-col-sm3 layui-col-md3 layui-col-lg3"
|
||||||
|
style="color: #FF5722;float: right;margin-right:5px"><i
|
||||||
|
th:text="${#dates.format(newBook.updateTime, 'MM-dd HH:mm')}"></i></div>
|
||||||
|
|
||||||
|
<div style="clear: both"></div>
|
||||||
|
<div style="padding-left: 5px;padding-top: 5px"
|
||||||
|
class="layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11"
|
||||||
|
th:text="'简介:'+ ${newBook.bookDesc}">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div th:replace="common/footer :: footer">
|
||||||
|
</div>
|
||||||
|
<div th:replace="common/js :: js">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="/js/wap_collect.js"></script>
|
||||||
|
<script>
|
||||||
|
(function () {
|
||||||
|
var bp = document.createElement('script');
|
||||||
|
var curProtocol = window.location.protocol.split(':')[0];
|
||||||
|
if (curProtocol === 'https') {
|
||||||
|
bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
|
||||||
|
} else {
|
||||||
|
bp.src = 'http://push.zhanzhang.baidu.com/push.js';
|
||||||
|
}
|
||||||
|
var s = document.getElementsByTagName("script")[0];
|
||||||
|
s.parentNode.insertBefore(bp, s);
|
||||||
|
})();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function moreNewBooks(event) {
|
||||||
|
window.location.href = "/book/search";
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchBooks() {
|
||||||
|
var keywords = $("#title").val();
|
||||||
|
window.location.href = "/book/search?keyword=" + encodeURI(keywords);
|
||||||
|
}
|
||||||
|
|
||||||
|
function toMyCollect() {
|
||||||
|
var token = localStorage.getItem("token");
|
||||||
|
if (token) {
|
||||||
|
window.location.href = "/book/search?token=" + token;
|
||||||
|
} else {
|
||||||
|
window.location.href = "/user/login.html";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user