mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-01 15:26:37 +00:00
Compare commits
8 Commits
release_v3
...
v3.5.0
Author | SHA1 | Date | |
---|---|---|---|
755300db3c | |||
a790f8042d | |||
d0db2021a6 | |||
c403fc7496 | |||
e4927d7ac6 | |||
a00a2141f2 | |||
7cc7d8b541 | |||
e4822979e2 |
20
README.md
20
README.md
@ -78,6 +78,12 @@ novel-plus -- 父工程
|
||||
| Layui | 前端UI
|
||||
|
||||
|
||||
#### 开发工具
|
||||
感谢Jetbrains公司提供的免费License。
|
||||
|
||||
[]( https://www.jetbrains.com/?from=小说精品屋)
|
||||
|
||||
|
||||
#### 接口文档
|
||||
|
||||
[点击查看接口文档示例](doc/api/api.md)
|
||||
@ -199,8 +205,6 @@ novel-plus -- 父工程
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
#### 安装步骤
|
||||
|
||||
##### 数据库安装:
|
||||
@ -252,6 +256,14 @@ docker安装教程:[点击前往](https://my.oschina.net/java2nb/blog/4271989)
|
||||
|
||||
[点击前往官网查看](https://xiongxyang.gitee.io/home/service.htm)
|
||||
|
||||
问问题的三要素
|
||||
|
||||
1. 说明背景,使用了哪个模块,要做什么?
|
||||
|
||||
2. 怎么输入或操作的得到了什么结果? 截图,日志
|
||||
|
||||
3. 哪里不明白或有什么疑问 ?
|
||||
|
||||
#### 微信公众号(发布最新更新资讯、最新前端模版、最新爬虫规则、技术文档等)
|
||||
|
||||

|
||||
@ -266,12 +278,12 @@ docker安装教程:[点击前往](https://my.oschina.net/java2nb/blog/4271989)
|
||||
|
||||

|
||||
|
||||
### 免责声明
|
||||
#### 免责声明
|
||||
|
||||
本项目提供的爬虫工具仅用于采集项目初期的测试数据,请勿用于商业盈利。
|
||||
用户使用本系统从事任何违法违规的事情,一切后果由用户自行承担,作者不承担任何责任。
|
||||
|
||||
### 备注
|
||||
#### 备注
|
||||
|
||||
精品小说屋所有相关项目均已在开源中国公开,感兴趣的可进入[开源中国](https://www.oschina.net/p/fiction_house)按关键字`精品小说屋`搜索。
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
#端口号
|
||||
server:
|
||||
port: 8081
|
||||
servlet:
|
||||
session:
|
||||
timeout: 1D
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
@ -19,3 +22,6 @@ crawl:
|
||||
thread: 1
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -39,6 +39,12 @@
|
||||
<version>${jest.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--aliyunOSS-->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
|
@ -0,0 +1,41 @@
|
||||
package com.java2nb.novel.core.config;
|
||||
|
||||
|
||||
import org.apache.http.HttpHost;
|
||||
import org.elasticsearch.client.RestClient;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* elasticsearch搜索引擎配置
|
||||
* @author xiongxiaoyang
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "spring.elasticsearch", name = "enable", havingValue = "1")
|
||||
public class EsConfig {
|
||||
|
||||
@Value("${spring.elasticsearch.jest.uris}")
|
||||
private String esUris;
|
||||
|
||||
@Bean
|
||||
public RestHighLevelClient esClient(){
|
||||
|
||||
|
||||
String[] uris = esUris.split(",");
|
||||
HttpHost[] hosts = new HttpHost[uris.length];
|
||||
for(int i = 0 ; i < uris.length ; i++){
|
||||
String uri = uris[i];
|
||||
String scheme = uri.substring(0,uri.indexOf(":")).trim();
|
||||
String hostname = uri.substring(uri.indexOf("://")+3,uri.lastIndexOf(":")).trim();
|
||||
Integer port = Integer.parseInt(uri.substring(uri.lastIndexOf(":")+1).trim());
|
||||
hosts[i] = new HttpHost(hostname,port,scheme);
|
||||
}
|
||||
|
||||
return new RestHighLevelClient(
|
||||
RestClient.builder(hosts));
|
||||
|
||||
}
|
||||
}
|
@ -2,19 +2,11 @@ package com.java2nb.novel.core.schedule;
|
||||
|
||||
import com.java2nb.novel.core.cache.CacheKey;
|
||||
import com.java2nb.novel.core.cache.CacheService;
|
||||
import com.java2nb.novel.core.utils.BeanUtil;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.service.BookService;
|
||||
import com.java2nb.novel.service.SearchService;
|
||||
import com.java2nb.novel.vo.EsBookVO;
|
||||
import io.searchbox.client.JestClient;
|
||||
import io.searchbox.core.DocumentResult;
|
||||
import io.searchbox.core.Index;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -68,8 +60,6 @@ public class BookToEsSchedule {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
cacheService.setObject(CacheKey.ES_LAST_UPDATE_TIME, lastDate);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -600,6 +600,7 @@ public class BookServiceImpl implements BookService {
|
||||
return bookMapper.selectMany(select(book.allColumns())
|
||||
.from(book)
|
||||
.where(updateTime, isGreaterThan(startDate))
|
||||
.and(lastIndexId,isNotNull())
|
||||
.orderBy(updateTime)
|
||||
.limit(limit)
|
||||
.build()
|
||||
|
@ -11,11 +11,19 @@ import com.java2nb.novel.search.BookSP;
|
||||
import com.java2nb.novel.service.SearchService;
|
||||
import com.java2nb.novel.vo.EsBookVO;
|
||||
import io.searchbox.client.JestClient;
|
||||
import io.searchbox.core.*;
|
||||
import io.searchbox.core.Count;
|
||||
import io.searchbox.core.CountResult;
|
||||
import io.searchbox.core.Search;
|
||||
import io.searchbox.core.SearchResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.elasticsearch.action.index.IndexRequest;
|
||||
import org.elasticsearch.action.index.IndexResponse;
|
||||
import org.elasticsearch.client.RequestOptions;
|
||||
import org.elasticsearch.client.RestHighLevelClient;
|
||||
import org.elasticsearch.common.xcontent.XContentType;
|
||||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.elasticsearch.index.query.QueryBuilders;
|
||||
import org.elasticsearch.search.builder.SearchSourceBuilder;
|
||||
@ -37,12 +45,12 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
public class SearchServiceImpl implements SearchService {
|
||||
|
||||
private final String INDEX = "novel";
|
||||
|
||||
private final String TYPE = "book";
|
||||
|
||||
private final JestClient jestClient;
|
||||
|
||||
private final RestHighLevelClient restHighLevelClient;
|
||||
|
||||
private final String INDEX = "novel";
|
||||
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
@ -51,10 +59,13 @@ public class SearchServiceImpl implements SearchService {
|
||||
EsBookVO esBookVO = new EsBookVO();
|
||||
BeanUtils.copyProperties(book, esBookVO, "lastIndexUpdateTime");
|
||||
esBookVO.setLastIndexUpdateTime(new SimpleDateFormat("yyyy/MM/dd HH:mm").format(book.getLastIndexUpdateTime()));
|
||||
Index action = new Index.Builder(esBookVO).index(INDEX).type(TYPE).id(book.getId().toString()).build();
|
||||
|
||||
jestClient.execute(action);
|
||||
IndexRequest request = new IndexRequest(INDEX);
|
||||
request.id(book.getId()+"");
|
||||
request.source(new ObjectMapper().writeValueAsString(esBookVO), XContentType.JSON);
|
||||
IndexResponse index = restHighLevelClient.index(request, RequestOptions.DEFAULT);
|
||||
|
||||
log.debug(index.getResult().toString());
|
||||
|
||||
}
|
||||
|
||||
@ -102,7 +113,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
searchSourceBuilder.query(boolQueryBuilder);
|
||||
|
||||
|
||||
Count count = new Count.Builder().addIndex(INDEX).addType(TYPE)
|
||||
Count count = new Count.Builder().addIndex(INDEX)
|
||||
.query(searchSourceBuilder.toString()).build();
|
||||
CountResult results = jestClient.execute(count);
|
||||
Double total = results.getCount();
|
||||
@ -130,7 +141,7 @@ public class SearchServiceImpl implements SearchService {
|
||||
searchSourceBuilder.size(pageSize);
|
||||
|
||||
// 构建Search对象
|
||||
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(INDEX).addType(TYPE).build();
|
||||
Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(INDEX).build();
|
||||
log.debug(search.toString());
|
||||
SearchResult result;
|
||||
result = jestClient.execute(search);
|
||||
|
@ -23,7 +23,7 @@ spring:
|
||||
#是否开启搜索引擎,1:开启,0:不开启
|
||||
enable: 0
|
||||
jest:
|
||||
uris: http://127.0.0.1:9200
|
||||
uris: http://192.168.0.105:9200
|
||||
|
||||
#thymeleaf模版路径配置
|
||||
thymeleaf:
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 150 KiB |
@ -4,9 +4,9 @@
|
||||
|
||||
<head th:replace="common/header :: common_head(~{::title},~{::meta},~{::link},~{})">
|
||||
<title th:text="${application.website.name}+'_原创小说网站'"></title>
|
||||
<meta name="keywords" th:content="${application.website.name}+',小说,小说网,言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,原创网络文学'"/>
|
||||
<meta name="keywords" th:content="${application.website.keyword}"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.name}+'每日更新小说连载,小说排行榜,提供言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,首发小说,最新章节免费小说阅读,精彩尽在'+${application.website.name}+'。'"/>
|
||||
th:content="${application.website.description}"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
|
@ -204,9 +204,9 @@
|
||||
</p>
|
||||
<div class="indexDiv" style="height: 42px;line-height: 42px;text-align:center;background: #f2f2f2">
|
||||
|
||||
<a style="color: #333" th:href="${preBookIndexId!=0?'/book/'+book.id+'/'+preBookIndexId+'.html':'#'}">上一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a>
|
||||
<a style="color: #333" th:href="'/book/indexList-'+${book.id}+'.html'">目录</a>
|
||||
<a style="color: #333" th:href="${nextBookIndexId!=0?'/book/'+book.id+'/'+nextBookIndexId+'.html':'#'}">下一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
|
||||
</div>
|
||||
<!--<div id="screenInput" class="screen_toolbar" style="display: none">
|
||||
<div style="height: 5px" class="layui-col-xs2 layui-col-sm3 layui-col-md3 layui-col-lg3"></div>
|
||||
@ -244,9 +244,9 @@
|
||||
</div>
|
||||
<div class="indexDiv" style="height: 42px;line-height: 42px;text-align:center;background: #f2f2f2">
|
||||
|
||||
<a style="color: #333" th:href="${preBookIndexId!=0?'/book/'+book.id+'/'+preBookIndexId+'.html':'#'}">上一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a>
|
||||
<a style="color: #333" th:href="'/book/indexList-'+${book.id}+'.html'">目录</a>
|
||||
<a style="color: #333" th:href="${nextBookIndexId!=0?'/book/'+book.id+'/'+nextBookIndexId+'.html':'#'}">下一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
|
||||
|
||||
</div>
|
||||
|
||||
@ -357,6 +357,24 @@
|
||||
$.post("/book/addVisitCount", {"bookId": $("#bookIdHidden").val()}, function () {
|
||||
});
|
||||
|
||||
|
||||
function enterPreIndexPage(bookId,bookIndexId){
|
||||
if(bookIndexId != 0){
|
||||
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
|
||||
}else{
|
||||
window.location.href = '/book/indexList-' + bookId + '.html';
|
||||
}
|
||||
|
||||
}
|
||||
function enterNextIndexPage(bookId,bookIndexId){
|
||||
if(bookIndexId != 0){
|
||||
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
|
||||
}else{
|
||||
window.location.href = '/book/indexList-' + bookId + '.html';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -8,15 +8,9 @@
|
||||
|
||||
<title th:text="${application.website.name}"></title>
|
||||
|
||||
<meta name="keywords" th:content="${application.website.name}+',精品小说,弹幕网站,弹幕,弹幕小说网站,免费小说,小说阅读,小说排行,轻小说,txt小说下载,电子书下载,动漫轻小说,日本轻小说'">
|
||||
|
||||
<meta name="keywords" th:content="${application.website.keyword}"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.name}+'是国内优秀的小说弹幕网站,'+${application.website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'">
|
||||
|
||||
<meta property="og:type" content="novel_index"/>
|
||||
<meta property="og:title" th:content="${application.website.name}"/>
|
||||
<meta property="og:description"
|
||||
th:content="${application.website.name}+'是国内优秀的小说弹幕网站,'+${application.website.name}+'提供海量热门网络小说,日本轻小说,国产轻小说,动漫小说,轻小说在线阅读和TXT小说下载,致力于网络精品小说的收集,智能计算小说评分,打造小说精品排行榜,致力于无广告无弹窗的小说阅读环境。'"/>
|
||||
th:content="${application.website.description}"/>
|
||||
|
||||
|
||||
<div th:include="mobile/common/css :: css"></div>
|
||||
|
4
pom.xml
4
pom.xml
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.java2nb</groupId>
|
||||
<artifactId>novel</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<version>3.4.1</version>
|
||||
<modules>
|
||||
<module>novel-common</module>
|
||||
<module>novel-front</module>
|
||||
@ -37,7 +37,7 @@
|
||||
<orderbyhelper.version>1.0.2</orderbyhelper.version>
|
||||
<commons-lang3.version>3.4</commons-lang3.version>
|
||||
<jjwt.version>0.9.0</jjwt.version>
|
||||
<elasticsearch.version>6.2.2</elasticsearch.version>
|
||||
<elasticsearch.version>7.9.3</elasticsearch.version>
|
||||
<jest.version>6.3.1</jest.version>
|
||||
<redis.version>1.4.1.RELEASE</redis.version>
|
||||
<redisson.version>3.12.5</redisson.version>
|
||||
|
@ -204,9 +204,9 @@
|
||||
</p>
|
||||
<div class="indexDiv" style="height: 42px;line-height: 42px;text-align:center;background: #f2f2f2">
|
||||
|
||||
<a style="color: #333" th:href="${preBookIndexId!=0?'/book/'+book.id+'/'+preBookIndexId+'.html':'#'}">上一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a>
|
||||
<a style="color: #333" th:href="'/book/indexList-'+${book.id}+'.html'">目录</a>
|
||||
<a style="color: #333" th:href="${nextBookIndexId!=0?'/book/'+book.id+'/'+nextBookIndexId+'.html':'#'}">下一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
|
||||
</div>
|
||||
<!--<div id="screenInput" class="screen_toolbar" style="display: none">
|
||||
<div style="height: 5px" class="layui-col-xs2 layui-col-sm3 layui-col-md3 layui-col-lg3"></div>
|
||||
@ -244,9 +244,9 @@
|
||||
</div>
|
||||
<div class="indexDiv" style="height: 42px;line-height: 42px;text-align:center;background: #f2f2f2">
|
||||
|
||||
<a style="color: #333" th:href="${preBookIndexId!=0?'/book/'+book.id+'/'+preBookIndexId+'.html':'#'}">上一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterPreIndexPage(\''+${book.id}+'\',\''+${preBookIndexId}+'\');'">上一章</a>
|
||||
<a style="color: #333" th:href="'/book/indexList-'+${book.id}+'.html'">目录</a>
|
||||
<a style="color: #333" th:href="${nextBookIndexId!=0?'/book/'+book.id+'/'+nextBookIndexId+'.html':'#'}">下一章</a>
|
||||
<a style="color: #333" th:href="'javascript:enterNextIndexPage(\''+${book.id}+'\',\''+${nextBookIndexId}+'\');'">下一章</a>
|
||||
|
||||
</div>
|
||||
|
||||
@ -357,6 +357,24 @@
|
||||
$.post("/book/addVisitCount", {"bookId": $("#bookIdHidden").val()}, function () {
|
||||
});
|
||||
|
||||
|
||||
function enterPreIndexPage(bookId,bookIndexId){
|
||||
if(bookIndexId != 0){
|
||||
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
|
||||
}else{
|
||||
window.location.href = '/book/indexList-' + bookId + '.html';
|
||||
}
|
||||
|
||||
}
|
||||
function enterNextIndexPage(bookId,bookIndexId){
|
||||
if(bookIndexId != 0){
|
||||
window.location.href = '/book/'+bookId+'/'+bookIndexId+".html";
|
||||
}else{
|
||||
window.location.href = '/book/indexList-' + bookId + '.html';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user