mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-01 15:26:37 +00:00
Compare commits
9 Commits
release_v2
...
v2.1.2
Author | SHA1 | Date | |
---|---|---|---|
68abdeca93 | |||
0b505a3922 | |||
353cb8c536 | |||
e1e1310b9e | |||
4c42ac0d29 | |||
d025d3d514 | |||
a0fb8e481a | |||
80b933db8d | |||
87a060280a |
24
README.md
24
README.md
@ -54,11 +54,9 @@ Springboot+Mybatis+Mysql+ElasticSearch+Ehcache+Thymeleaf+Layui
|
|||||||
|
|
||||||
3. 搜索页
|
3. 搜索页
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
4. 排行榜
|
4. 排行榜
|
||||||
|
|
||||||
@ -94,35 +92,27 @@ Springboot+Mybatis+Mysql+ElasticSearch+Ehcache+Thymeleaf+Layui
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 手机站截图
|
#### 手机站截图
|
||||||
|
|
||||||
1. 首页
|
1. 首页
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
2. 小说详情页
|
2. 小说详情页
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
3. 目录页
|
3. 目录页
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
4. 小说阅读页
|
4. 小说阅读页
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### 爬虫管理系统截图
|
#### 爬虫管理系统截图
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
#### 后台管理系统截图
|
#### 后台管理系统截图
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 62 KiB |
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.1.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import org.springframework.http.HttpHeaders;
|
|||||||
import org.springframework.http.HttpMethod;
|
import org.springframework.http.HttpMethod;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -48,6 +49,11 @@ public class FileUtil {
|
|||||||
out.write(b, 0, n);
|
out.write(b, 0, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
out.flush();
|
||||||
|
if( ImageIO.read(picFile) == null){
|
||||||
|
picSrc = "/images/default.gif";
|
||||||
|
}
|
||||||
|
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error(e.getMessage(),e);
|
log.error(e.getMessage(),e);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.1.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ import static java.util.regex.Pattern.compile;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class CrawlParser {
|
public class CrawlParser {
|
||||||
|
|
||||||
|
private static IdWorker idWorker = new IdWorker();
|
||||||
|
|
||||||
public static final Integer BOOK_INDEX_LIST_KEY = 1;
|
public static final Integer BOOK_INDEX_LIST_KEY = 1;
|
||||||
|
|
||||||
public static final Integer BOOK_CONTENT_LIST_KEY = 2;
|
public static final Integer BOOK_CONTENT_LIST_KEY = 2;
|
||||||
@ -94,6 +96,8 @@ public class CrawlParser {
|
|||||||
|
|
||||||
String desc = bookDetailHtml.substring(bookDetailHtml.indexOf(ruleBean.getDescStart()) + ruleBean.getDescStart().length());
|
String desc = bookDetailHtml.substring(bookDetailHtml.indexOf(ruleBean.getDescStart()) + ruleBean.getDescStart().length());
|
||||||
desc = desc.substring(0, desc.indexOf(ruleBean.getDescEnd()));
|
desc = desc.substring(0, desc.indexOf(ruleBean.getDescEnd()));
|
||||||
|
//过滤掉简介中的a标签
|
||||||
|
desc = desc.replaceAll("<a[^<]+</a>","");
|
||||||
//设置书籍简介
|
//设置书籍简介
|
||||||
book.setBookDesc(desc);
|
book.setBookDesc(desc);
|
||||||
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
||||||
@ -173,6 +177,7 @@ public class CrawlParser {
|
|||||||
String lastIndexName = null;
|
String lastIndexName = null;
|
||||||
|
|
||||||
while (isFindIndex) {
|
while (isFindIndex) {
|
||||||
|
|
||||||
BookIndex hasIndex = hasIndexs.get(indexNum);
|
BookIndex hasIndex = hasIndexs.get(indexNum);
|
||||||
String indexName = indexNameMatch.group(1);
|
String indexName = indexNameMatch.group(1);
|
||||||
|
|
||||||
@ -199,7 +204,7 @@ public class CrawlParser {
|
|||||||
if(hasIndexs.size() == 0){
|
if(hasIndexs.size() == 0){
|
||||||
//新书入库
|
//新书入库
|
||||||
//设置目录和章节内容
|
//设置目录和章节内容
|
||||||
Long indexId = new IdWorker().nextId();
|
Long indexId = idWorker.nextId();
|
||||||
lastIndexId = indexId;
|
lastIndexId = indexId;
|
||||||
lastIndexName = indexName;
|
lastIndexName = indexName;
|
||||||
bookIndex.setId(indexId);
|
bookIndex.setId(indexId);
|
||||||
|
@ -167,6 +167,11 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
boolean isFindBookId = bookIdMatcher.find();
|
boolean isFindBookId = bookIdMatcher.find();
|
||||||
while (isFindBookId) {
|
while (isFindBookId) {
|
||||||
try {
|
try {
|
||||||
|
if(Thread.currentThread().isInterrupted()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
String bookId = bookIdMatcher.group(1);
|
String bookId = bookIdMatcher.group(1);
|
||||||
Book book = CrawlParser.parseBook(ruleBean, bookId);
|
Book book = CrawlParser.parseBook(ruleBean, bookId);
|
||||||
//这里只做新书入库,查询是否存在这本书
|
//这里只做新书入库,查询是否存在这本书
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>2.1.0</version>
|
<version>2.1.2</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public class AuthorController extends BaseController{
|
|||||||
* 发布小说
|
* 发布小说
|
||||||
* */
|
* */
|
||||||
@PostMapping("addBook")
|
@PostMapping("addBook")
|
||||||
public ResultBean addBook(Book book,HttpServletRequest request){
|
public ResultBean addBook(@RequestParam("bookDesc") String bookDesc,Book book,HttpServletRequest request){
|
||||||
|
|
||||||
//查询作家信息
|
//查询作家信息
|
||||||
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
Author author = authorService.queryAuthor(getUserDetails(request).getId());
|
||||||
@ -67,6 +67,10 @@ public class AuthorController extends BaseController{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//bookDesc不能使用book对象来接收,否则会自动去掉前面的空格
|
||||||
|
book.setBookDesc(bookDesc
|
||||||
|
.replaceAll("\\n","<br>")
|
||||||
|
.replaceAll("\\s"," "));
|
||||||
//发布小说
|
//发布小说
|
||||||
bookService.addBook(book,author.getId(),author.getPenName());
|
bookService.addBook(book,author.getId(),author.getPenName());
|
||||||
|
|
||||||
@ -109,6 +113,8 @@ public class AuthorController extends BaseController{
|
|||||||
return ResultBean.fail(ResponseStatus.AUTHOR_STATUS_FORBIDDEN);
|
return ResultBean.fail(ResponseStatus.AUTHOR_STATUS_FORBIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
content = content.replaceAll("\\n","<br>")
|
||||||
|
.replaceAll("\\s"," ");
|
||||||
//发布章节内容
|
//发布章节内容
|
||||||
bookService.addBookContent(bookId,indexName,content,author.getId());
|
bookService.addBookContent(bookId,indexName,content,author.getId());
|
||||||
|
|
||||||
|
@ -130,33 +130,43 @@
|
|||||||
<script src="/javascript/header.js" type="text/javascript"></script>
|
<script src="/javascript/header.js" type="text/javascript"></script>
|
||||||
<script src="/javascript/user.js" type="text/javascript"></script>
|
<script src="/javascript/user.js" type="text/javascript"></script>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
|
var lock = false;
|
||||||
function addBook() {
|
function addBook() {
|
||||||
|
if(lock){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lock = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var bookName = $("#bookName").val();
|
var bookName = $("#bookName").val();
|
||||||
if(!bookName){
|
if(!bookName){
|
||||||
$("#LabErr").html("小说名不能为空!");
|
$("#LabErr").html("小说名不能为空!");
|
||||||
|
lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(bookName.length > 20){
|
if(bookName.length > 20){
|
||||||
$("#LabErr").html("小说名太长!");
|
$("#LabErr").html("小说名太长!");
|
||||||
|
lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var picUrl = $("#picUrl").val();
|
var picUrl = $("#picUrl").val();
|
||||||
if(!picUrl){
|
if(!picUrl){
|
||||||
$("#LabErr").html("封面图片不能为空!");
|
$("#LabErr").html("封面图片不能为空!");
|
||||||
|
lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bookDesc = $("#bookDesc").val();
|
var bookDesc = $("#bookDesc").val();
|
||||||
if(!bookDesc){
|
if(!bookDesc){
|
||||||
$("#LabErr").html("简介不能为空!");
|
$("#LabErr").html("简介不能为空!");
|
||||||
|
lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/author/addBook",
|
url: "/author/addBook",
|
||||||
@ -171,11 +181,13 @@
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
lock = false;
|
||||||
$("#LabErr").html(data.msg);
|
$("#LabErr").html(data.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
|
lock = false;
|
||||||
layer.alert('网络异常');
|
layer.alert('网络异常');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -58,10 +58,8 @@
|
|||||||
<b>章节名:</b>
|
<b>章节名:</b>
|
||||||
<li><input type="text" id="bookIndex" name="bookIndex" class="s_input" ></li>
|
<li><input type="text" id="bookIndex" name="bookIndex" class="s_input" ></li>
|
||||||
<b>章节内容:</b>
|
<b>章节内容:</b>
|
||||||
<input type="hidden" id="bookContent" name="bookContent" >
|
<textarea name="bookContent" rows="30" cols="80" id="bookContent"
|
||||||
<div style="width:600px" id="contentEditor">
|
class="textarea"></textarea>
|
||||||
|
|
||||||
</div>
|
|
||||||
<li style="margin-top: 10px"><input type="button" onclick="addBookContent()" name="btnRegister" value="提交"
|
<li style="margin-top: 10px"><input type="button" onclick="addBookContent()" name="btnRegister" value="提交"
|
||||||
id="btnRegister" class="btn_red">
|
id="btnRegister" class="btn_red">
|
||||||
|
|
||||||
@ -114,43 +112,18 @@
|
|||||||
<script src="/javascript/header.js" type="text/javascript"></script>
|
<script src="/javascript/header.js" type="text/javascript"></script>
|
||||||
<script src="/javascript/user.js" type="text/javascript"></script>
|
<script src="/javascript/user.js" type="text/javascript"></script>
|
||||||
<script src="/javascript/common.js" type="text/javascript"></script>
|
<script src="/javascript/common.js" type="text/javascript"></script>
|
||||||
<script type="text/javascript" src="/wangEditor/release/wangEditor.js"></script>
|
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
|
|
||||||
var E = window.wangEditor;
|
|
||||||
var editor2 = new E('#contentEditor');
|
|
||||||
// 自定义菜单配置
|
|
||||||
editor2.customConfig.menus = [
|
|
||||||
'head', // 标题
|
|
||||||
'bold', // 粗体
|
|
||||||
'fontSize', // 字号
|
|
||||||
'fontName', // 字体
|
|
||||||
'italic', // 斜体
|
|
||||||
'underline', // 下划线
|
|
||||||
'strikeThrough', // 删除线
|
|
||||||
'foreColor', // 文字颜色
|
|
||||||
//'backColor', // 背景颜色
|
|
||||||
//'link', // 插入链接
|
|
||||||
'list', // 列表
|
|
||||||
'justify', // 对齐方式
|
|
||||||
'quote', // 引用
|
|
||||||
'emoticon', // 表情
|
|
||||||
'image', // 插入图片
|
|
||||||
//'table', // 表格
|
|
||||||
//'video', // 插入视频
|
|
||||||
//'code', // 插入代码
|
|
||||||
'undo', // 撤销
|
|
||||||
'redo' // 重复
|
|
||||||
];
|
|
||||||
editor2.customConfig.onchange = function (html) {
|
|
||||||
// html 即变化之后的内容
|
|
||||||
$("#bookContent").val(html);
|
|
||||||
}
|
|
||||||
editor2.create();
|
|
||||||
|
|
||||||
|
var lock = false;
|
||||||
function addBookContent() {
|
function addBookContent() {
|
||||||
|
|
||||||
|
if(lock){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lock = true;
|
||||||
|
|
||||||
|
|
||||||
var bookId = getSearchString("bookId");
|
var bookId = getSearchString("bookId");
|
||||||
|
|
||||||
@ -158,12 +131,14 @@
|
|||||||
var indexName = $("#bookIndex").val();
|
var indexName = $("#bookIndex").val();
|
||||||
if(!indexName){
|
if(!indexName){
|
||||||
$("#LabErr").html("章节名不能为空!");
|
$("#LabErr").html("章节名不能为空!");
|
||||||
|
lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var content = $("#bookContent").val();
|
var content = $("#bookContent").val();
|
||||||
if(!content && content.length<=13){
|
if(!content){
|
||||||
$("#LabErr").html("章节内容不能为空!");
|
$("#LabErr").html("章节内容不能为空!");
|
||||||
|
lock = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,11 +157,13 @@
|
|||||||
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
lock = false;
|
||||||
$("#LabErr").html(data.msg);
|
$("#LabErr").html(data.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
|
lock = false;
|
||||||
layer.alert('网络异常');
|
layer.alert('网络异常');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -179,9 +179,13 @@
|
|||||||
for (var i = 0; i < bookList.length; i++) {
|
for (var i = 0; i < bookList.length; i++) {
|
||||||
var book = bookList[i];
|
var book = bookList[i];
|
||||||
|
|
||||||
var end = book.bookDesc.indexOf("<");
|
/*var end = book.bookDesc.indexOf("<");
|
||||||
if(end != -1) {
|
if(end != -1) {
|
||||||
book.bookDesc = book.bookDesc.substring(0,end);
|
book.bookDesc = book.bookDesc.substring(0,end);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
if(book.bookDesc){
|
||||||
|
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"").replace(/ /g,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||||
@ -202,7 +206,7 @@
|
|||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
" <div style=\"margin-top: 5px;color: #4c6978;\">类别:"+book.catName+"</div>\n" +
|
" <div style=\"margin-top: 5px;color: #4c6978;\">类别:"+book.catName+"</div>\n" +
|
||||||
" <div style=\"margin-top: 5px;color: #4c6978;\">状态:"+(book.bookStatus==0?'连载':'完结')+"</div>\n" +
|
" <div style=\"margin-top: 5px;color: #4c6978;\">状态:"+(book.bookStatus==0?'连载':'完结')+"</div>\n" +
|
||||||
" <div style=\"margin-top: 5px;color: #4c6978;\">更新:<i>"+book.lastIndexUpdateTime+"</i>\n" +
|
" <div style=\"margin-top: 5px;color: #4c6978;\">更新:<i>"+book.lastIndexUpdateTime.substr(0,11)+"</i>\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
" <div style=\"margin-top: 5px;color: #4c6978;\">简介:"+(book.bookDesc?(book.bookDesc.length>20?(book.bookDesc.substr(0,20)+"..."):book.bookDesc):book.bookDesc)+"</div>\n" +
|
" <div style=\"margin-top: 5px;color: #4c6978;\">简介:"+(book.bookDesc?(book.bookDesc.length>20?(book.bookDesc.substr(0,20)+"..."):book.bookDesc):book.bookDesc)+"</div>\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
|
@ -276,6 +276,10 @@
|
|||||||
for (var i = 0; i < 6; i++) {
|
for (var i = 0; i < 6; i++) {
|
||||||
var hotRecBook = hotRecBooks[i];
|
var hotRecBook = hotRecBooks[i];
|
||||||
|
|
||||||
|
if(hotRecBook.bookDesc){
|
||||||
|
hotRecBook.bookDesc = hotRecBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"");
|
||||||
|
}
|
||||||
|
|
||||||
hotRecBooksHtml += ("<div style=\"margin-bottom: 5px\" class=\"layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4\">\n" +
|
hotRecBooksHtml += ("<div style=\"margin-bottom: 5px\" class=\"layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4\">\n" +
|
||||||
" <a href=\"/book/"+hotRecBook.bookId+".html\">\n" +
|
" <a href=\"/book/"+hotRecBook.bookId+".html\">\n" +
|
||||||
" <div class=\"layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4\" >\n" +
|
" <div class=\"layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4\" >\n" +
|
||||||
@ -323,9 +327,8 @@
|
|||||||
for (var i = 0; i < 10; i++) {
|
for (var i = 0; i < 10; i++) {
|
||||||
|
|
||||||
var updateRankBook = updateRankBooks[i];
|
var updateRankBook = updateRankBooks[i];
|
||||||
var end = updateRankBook.bookDesc.indexOf("<");
|
if(updateRankBook.bookDesc){
|
||||||
if(end != -1) {
|
updateRankBook.bookDesc = updateRankBook.bookDesc.replace(/<[^>]+>/g,"").replace(/\s+/g,"");
|
||||||
updateRankBook.bookDesc = updateRankBook.bookDesc.substring(0,end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateRankBookHtml += ("<div style=\"padding-bottom: 30px\"\n" +
|
updateRankBookHtml += ("<div style=\"padding-bottom: 30px\"\n" +
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<version>2.1.0</version>
|
<version>2.1.2</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>novel-common</module>
|
<module>novel-common</module>
|
||||||
<module>novel-front</module>
|
<module>novel-front</module>
|
||||||
|
Reference in New Issue
Block a user