mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
爬虫代码优化
This commit is contained in:
parent
0a10504461
commit
1b6cc8ccd5
@ -232,7 +232,6 @@ public class CrawlParser {
|
|||||||
bookContent.setContent(content);
|
bookContent.setContent(content);
|
||||||
contentList.add(bookContent);
|
contentList.add(bookContent);
|
||||||
|
|
||||||
|
|
||||||
if (hasIndex != null) {
|
if (hasIndex != null) {
|
||||||
//章节更新
|
//章节更新
|
||||||
bookIndex.setId(hasIndex.getId());
|
bookIndex.setId(hasIndex.getId());
|
||||||
@ -241,8 +240,6 @@ public class CrawlParser {
|
|||||||
//章节插入
|
//章节插入
|
||||||
//设置目录和章节内容
|
//设置目录和章节内容
|
||||||
Long indexId = idWorker.nextId();
|
Long indexId = idWorker.nextId();
|
||||||
lastIndexId = indexId;
|
|
||||||
lastIndexName = indexName;
|
|
||||||
bookIndex.setId(indexId);
|
bookIndex.setId(indexId);
|
||||||
bookIndex.setBookId(book.getId());
|
bookIndex.setBookId(book.getId());
|
||||||
|
|
||||||
@ -252,8 +249,14 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
bookIndex.setUpdateTime(currentDate);
|
bookIndex.setUpdateTime(currentDate);
|
||||||
|
|
||||||
//计算总字数
|
//判断是新书入库还是老书更新
|
||||||
totalWordCount += wordCount;
|
if (hasIndexs.size() == 0) {
|
||||||
|
//新书入库
|
||||||
|
lastIndexId = bookIndex.getId();
|
||||||
|
lastIndexName = indexName;
|
||||||
|
//计算总字数
|
||||||
|
totalWordCount += wordCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user