增加爬取小说数据最低分的配置

This commit is contained in:
xiongxiaoyang 2019-11-12 11:25:03 +08:00
parent 9f18dd8f2f
commit 587d79c967
5 changed files with 19 additions and 7 deletions

View File

@ -15,17 +15,23 @@ Springboot+Mybatis+Mysql+Ehcache+Thymeleaf+Layui
2. 修改项目application.yml配置文件中的数据库配置。
![](./assets/database_config.png)
3. 修改项目application.yml配置文件中的首页本站推荐小说配置修改的小说需要在数据库中存在
![](./assets/index_config.png)
4. 本地直接运行或使用maven插件打包成jar文件上传到服务器上
4. 根据需求修改项目application.yml配置文件中的爬取小说最低分配置
5. `http://ip:port`访问首页。
![](./assets/score_config.png)
6. `http://ip:port/books`访问精品小说模块
5. 本地直接运行或使用maven插件打包成jar文件上传到服务器上
7. `http://ip:port/book/searchSoftBook.html`访问轻小说模块。
6. `http://ip:port`访问首页。
7. `http://ip:port/books`访问精品小说模块。
8. `http://ip:port/book/searchSoftBook.html`访问轻小说模块。
#### 项目截图

BIN
assets/database_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

BIN
assets/score_config.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -3,6 +3,7 @@ package xyz.zinglizingli.common.schedule;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.Scheduled;
@ -33,6 +34,9 @@ public class CrawlBooksSchedule {
RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
@Value("${books.lowestScore}")
private Float lowestScore;
private boolean isExcuting = false;
@ -485,7 +489,7 @@ public class CrawlBooksSchedule {
try {
Float score = Float.parseFloat(scoreMatch.group(1));
if (score < 8.0) {//数据库空间有效暂时爬取7.5分以上的小说
if (score < lowestScore) {//数据库空间有限暂时爬取8.0分以上的小说
continue;
}
@ -725,7 +729,7 @@ public class CrawlBooksSchedule {
try {
Float score = Float.parseFloat(scoreMatch.group(1));
if (score < 8.0) {//数据库空间有效暂时爬取7.5分以上的小说
if (score < lowestScore) {//数据库空间有限暂时爬取8.0分以上的小说
continue;
}
String bookName = bookNameMatch.group(1);

View File

@ -62,7 +62,9 @@ index:
mysql:
charset: utf8mb4
#爬取小说数据的最低评分
books:
lowestScore: 8.0
search: