Compare commits

...

60 Commits
4.2.x ... 4.4.x

Author SHA1 Message Date
d8e559ab50 修复规则 2024-11-02 21:19:27 +08:00
3849a9b86f build: 修改版本号 2024-11-02 18:32:01 +08:00
71b9d1d916 模版更新 2024-11-02 18:31:47 +08:00
4b9dbe969c 修复i笔趣阁爬虫规则 2024-11-02 18:26:40 +08:00
2136f7490f 增加爬虫规则 2024-11-02 13:24:28 +08:00
3586ffbc0a 优化 2024-09-21 11:14:07 +08:00
f78a2a36cf 优化 2024-09-21 11:10:44 +08:00
a8219253e9 优化 2024-09-21 10:15:45 +08:00
5c35f7af0a 更换默认logo图片 2024-09-16 21:08:32 +08:00
d55e1a3e22 revert: sql格式化还原 2024-08-06 22:42:43 +08:00
21a6a49ce9 fix: 作家稿费统计 2024-08-06 21:14:22 +08:00
3735023cef perf(novel-front): UI优化 2024-07-20 21:48:29 +08:00
89992dc781 perf(novel-crawl): 增加小说内容过滤 2024-06-01 09:56:07 +08:00
976db9420e build: 修改版本号 2024-05-31 20:59:34 +08:00
e33db86081 Update README.md 2024-05-28 12:34:00 +08:00
48a70c2aca build: 修改版本号 2024-05-28 09:45:23 +08:00
ea5c0e8bd1 模版更新 2024-05-28 09:42:27 +08:00
b0c249cdca fix: 默认logo图片失效 2024-05-26 22:50:57 +08:00
730fcb4c76 fix: 默认logo图片失效 2024-05-26 22:46:46 +08:00
b976a00389 perf: UI优化 2024-05-26 22:31:26 +08:00
6d9b563583 fix: 文件上传大小限制 2024-05-25 22:05:03 +08:00
bfb7d6cc5c fix: i笔趣阁域名更换 2024-05-12 17:26:59 +08:00
9d4dc409c6 fix: URI编码 2024-03-03 11:10:46 +08:00
34d211afbf fix: 只推荐有内容的小说 2024-02-21 19:27:48 +08:00
2d218076c4 chore: 修改打包默认模版 2024-02-18 10:28:29 +08:00
674e4df84c chore: 模版更新 2024-02-07 14:59:31 +08:00
331f56d112 fix: 移动端首页在数据量小于10时报错 2024-02-07 14:58:36 +08:00
f494aae2c7 chore: 模版更新 2024-02-07 14:23:32 +08:00
2fc533f8ae fix(novel-crawl): 登录页样式问题 2024-02-05 21:12:41 +08:00
82758271e3 feat: 增加语音播放小说内容 2024-02-05 12:05:26 +08:00
4c82c2d720 perf: 优化支付宝支付流程 2024-02-04 12:25:26 +08:00
4665b5c4b9 fix: bug 2024-02-03 16:14:36 +08:00
7bbabb3492 fix: 修复充值页面的未登录跳转路径 2024-02-03 14:03:23 +08:00
d6093d8182 fix(novel-admin): 友情链接URL格式校验 2023-12-29 18:54:53 +08:00
f77792aa3c perf: 限制昵称长度并优化显示 2023-12-29 00:34:04 +08:00
c62da9bb3a fix: nickName、userPhoto 更新校验 2023-12-29 00:11:01 +08:00
8a63cff0b5 Update README.md 2023-10-31 08:24:54 +08:00
07bed12fa5 fix(mobile): 充值页标题 2023-10-30 14:17:03 +08:00
0d6e0ffb06 perf(mobile): 内容页优化
去掉小说内容前面的多余空格
2023-10-30 14:07:31 +08:00
e7005004bb perf(mobile): 登录/注册页优化 2023-10-30 14:01:39 +08:00
ff68cdd829 perf(mobile): 首页优化 2023-10-30 14:01:24 +08:00
b61dc4d0d5 build(Docker): 管理 Dockerfile 文件 2023-10-22 19:20:52 +08:00
98f1f804c3 chore(sql): 自动创建 novel_plus 数据库 2023-10-22 19:07:32 +08:00
5978d6cbcc build: 修改版本号 2023-10-21 21:21:54 +08:00
ef290bed9c fix: 书架列表时间格式化 2023-10-21 21:02:00 +08:00
5543e5aa57 perf: 设置网站 ico 图标 2023-10-15 20:30:11 +08:00
0332802fe5 feat(crawl): 账号退出 2023-10-15 19:13:07 +08:00
a55f456b3d perf: 更新爬虫管理系统主题颜色 2023-10-15 17:54:44 +08:00
f6d66e69fb Update README.md 2023-10-14 18:19:00 +08:00
96960789e1 fix(alipay): 修改默认支付宝支付成功跳转地址 2023-10-14 17:50:14 +08:00
1998dcd460 fix(alipay): 修复支付宝支付页面报错
沙箱环境自动升级到新版后,没有在代码中更换新版本的应用/网关/账号信息,也没有从左边栏沙箱工具中下载最新版本的沙箱支付宝APP安装使用。
2023-10-14 17:42:42 +08:00
a33d8f68a2 删除垃圾文件 2023-10-14 13:42:37 +08:00
30959da038 删除垃圾文件 2023-10-14 13:39:11 +08:00
5406783344 删除垃圾文件 2023-10-14 12:54:33 +08:00
d84345918b Update README.md 2023-10-14 10:32:46 +08:00
a5394cb426 Update README.md 2023-10-14 10:20:16 +08:00
2275b85752 chore: 模版更新 2023-10-14 10:16:41 +08:00
2062123edd perf(mobile): 去除手机网站底部空白间隙 2023-10-14 10:06:16 +08:00
255b3f8c4b feat(templates): 新增绿色主题模版,并设置为默认模版
和文档站点 docs.xxyopen.com 风格保持一致
2023-10-13 21:21:21 +08:00
00179359bd chore: 更新 Dockerfile 文件 2023-10-12 16:33:57 +08:00
722 changed files with 59699 additions and 20205 deletions

View File

@ -57,9 +57,17 @@ novel-plus -- 父工程
| Thymeleaf | 模板引擎
| Layui | 前端 UI 框架
## 项目演示
## 项目截图
https://www.bilibili.com/video/BV1Zo4y187Mi
### 绿色主题模版
[![点击查看大图](https://www.xxyopen.com/images/green_novel.png)](https://www.xxyopen.com/images/green_novel.png)
[![点击查看大图](https://www.xxyopen.com/images/resource/os/novel-plus/green3.png)](https://www.xxyopen.com/images/resource/os/novel-plus/green3.png)
[![点击查看大图](https://www.xxyopen.com/images/resource/os/novel-plus/green2.png)](https://www.xxyopen.com/images/resource/os/novel-plus/green2.png)
## 演示视频
https://www.bilibili.com/video/BV18e41197xs
## 增值服务

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 411 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 263 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 461 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 310 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 360 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 357 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 307 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 929 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 185 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 764 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

View File

@ -1,116 +0,0 @@
<h1 class="curproject-name"> 小说精品屋-plus </h1>
小说精品屋-plus接口
# 作家模块
## 小说章节分页列表查询接口
<a id=小说章节分页列表查询接口> </a>
### 基本信息
**Path** /book/queryIndexList
**Method** GET
**接口描述:**
<p>作家后台章节管理页面需要请求该接口获取小说章节分页列表信息</p>
### 请求参数
**Query**
| 参数名称 | 是否必须 | 示例 | 备注 |
| ------------ | ------------ | ------------ | ------------ |
| bookId | 是 | 1334337530296893441 | 小说ID |
| curr | 否 | 1 | 查询页码默认1 |
| limit | 否 | 5 | 分页大小默认5 |
### 返回数据
<table>
<thead class="ant-table-thead">
<tr>
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
</tr>
</thead><tbody className="ant-table-tbody"><tr key=0-0><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> code</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应状态吗200表示成功</span></td><td key=5></td></tr><tr key=0-1><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> msg</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应信息</span></td><td key=5></td></tr><tr key=0-2><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> data</span></td><td key=1><span>object</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应数据</span></td><td key=5></td></tr><tr key=0-2-0><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> total</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">总数量</span></td><td key=5></td></tr><tr key=0-2-1><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> list</span></td><td key=1><span>object []</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">章节数据集合</span></td><td key=5><p key=3><span style="font-weight: '700'">item 类型: </span><span>object</span></p></td></tr><tr key=0-2-1-0><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> id</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">章节ID</span></td><td key=5></td></tr><tr key=0-2-1-1><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> bookId</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">小说ID</span></td><td key=5></td></tr><tr key=0-2-1-2><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> indexName</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">章节名</span></td><td key=5></td></tr><tr key=0-2-1-3><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> isVip</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">是否收费1:收费0:免费</span></td><td key=5></td></tr><tr key=0-2-1-4><td key=0><span style="padding-left: 40px"><span style="color: #8c8a8a">├─</span> updateTime</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">更新时间</span></td><td key=5></td></tr><tr key=0-2-2><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> pageNum</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">页码</span></td><td key=5></td></tr><tr key=0-2-3><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> pageSize</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">分页大小</span></td><td key=5></td></tr><tr key=0-2-4><td key=0><span style="padding-left: 20px"><span style="color: #8c8a8a">├─</span> size</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">当前页数量</span></td><td key=5></td></tr>
</tbody>
</table>
## 小说章节删除接口
<a id=小说章节删除接口> </a>
### 基本信息
**Path** /author/deleteIndex/{indexId}
**Method** DELETE
**接口描述:**
<p>作家后台章节管理页面点击删除按钮请求该接口删除小说章节内容</p>
### 请求参数
**Headers**
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
| ------------ | ------------ | ------------ | ------------ | ------------ |
| Content-Type | application/x-www-form-urlencoded | 是 | | |
| Authorization | | 是 | eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MDgzNDg0NzksInN1YiI6IntcImlkXCI6MTI1NTA2MDMyODMyMjAyNzUyMCxcInVzZXJuYW1lXCI6XCIxMzU2MDQyMTMyNFwiLFwibmlja05hbWVcIjpcIjEzNTYwNDIxMzI0XCJ9IiwiY3JlYXRlZCI6MTYwNzc0MzY3OTkxM30.0qhwis_zPb6t8wGNejMhDZ2iHCL9Tgh2UHd1gcQBCp8t6RW3ggSwtfo4l_RgMT_v8jOkLW91GzTVWlNnTE6LCA | 认证JWT请求登录接口成功后返回 |
**路径参数**
| 参数名称 | 示例 | 备注 |
| ------------ | ------------ | ------------ |
| indexId | 1337603246936645632 | 章节ID |
### 返回数据
<table>
<thead class="ant-table-thead">
<tr>
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
</tr>
</thead><tbody className="ant-table-tbody"><tr key=0-0><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> code</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应状态吗200表示成功</span></td><td key=5></td></tr><tr key=0-1><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> msg</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应信息</span></td><td key=5></td></tr>
</tbody>
</table>
## 小说章节发布接口
<a id=小说章节发布接口> </a>
### 基本信息
**Path** /author/addBookContent
**Method** POST
**接口描述:**
<p>作家后台章节发布页面点击提交按钮请求该接口新增小说章节内容</p>
### 请求参数
**Headers**
| 参数名称 | 参数值 | 是否必须 | 示例 | 备注 |
| ------------ | ------------ | ------------ | ------------ | ------------ |
| Content-Type | application/x-www-form-urlencoded | 是 | | |
| Authorization | | 是 | eyJhbGciOiJIUzUxMiJ9.eyJleHAiOjE2MDgzNDg0NzksInN1YiI6IntcImlkXCI6MTI1NTA2MDMyODMyMjAyNzUyMCxcInVzZXJuYW1lXCI6XCIxMzU2MDQyMTMyNFwiLFwibmlja05hbWVcIjpcIjEzNTYwNDIxMzI0XCJ9IiwiY3JlYXRlZCI6MTYwNzc0MzY3OTkxM30.0qhwis_zPb6t8wGNejMhDZ2iHCL9Tgh2UHd1gcQBCp8t6RW3ggSwtfo4l_RgMT_v8jOkLW91GzTVWlNnTE6LCA | 认证JWT请求登录接口成功后返回 |
**Body**
| 参数名称 | 参数类型 | 是否必须 | 示例 | 备注 |
| ------------ | ------------ | ------------ | ------------ | ------------ |
| bookId | text | 是 | 1334337530296893441 | 小说ID |
| indexName | text | 是 | 第六章未婚妻(下) | 章节名 |
| content | text | 是 | 开始之时,李七夜还是生疏无比,那怕他对于刀术的所有奥义了然于胸,但是,他出刀之时依然会颤抖,无法达到妙及巅毫的要求。 | 章节内容 |
| isVip | text | 是 | 1 | 是否收费1:收费0:免费 |
### 返回数据
<table>
<thead class="ant-table-thead">
<tr>
<th key=name>名称</th><th key=type>类型</th><th key=required>是否必须</th><th key=default>默认值</th><th key=desc>备注</th><th key=sub>其他信息</th>
</tr>
</thead><tbody className="ant-table-tbody"><tr key=0-0><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> code</span></td><td key=1><span>number</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应状态吗200表示成功</span></td><td key=5></td></tr><tr key=0-1><td key=0><span style="padding-left: 0px"><span style="color: #8c8a8a"></span> msg</span></td><td key=1><span>string</span></td><td key=2>必须</td><td key=3></td><td key=4><span style="white-space: pre-wrap">响应信息</span></td><td key=5></td></tr>
</tbody>
</table>

3
doc/sql/20240512.sql Normal file
View File

@ -0,0 +1,3 @@
update crawl_source
set crawl_rule = replace(crawl_rule, 'ibiquge.net', 'ibiquzw.org')
where id = 16;

2
doc/sql/Dockerfile Normal file
View File

@ -0,0 +1,2 @@
FROM mysql:8.0
COPY novel_plus.sql /docker-entrypoint-initdb.d/init.sql

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +0,0 @@
FROM java:8
ADD novel-admin-1.0.0.jar /root
ENV dburl=""
ENV username=""
ENV password=""
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -jar /root/novel-admin-1.0.0.jar"]

View File

@ -5,7 +5,7 @@
<groupId>com.java2nb</groupId>
<artifactId>novel-admin</artifactId>
<version>4.2.0</version>
<version>4.4.0</version>
<packaging>jar</packaging>
<name>novel-admin</name>
@ -296,6 +296,9 @@
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
<zipfileset filemode="755" dir='${project.build.directory}/build/'/>
</zip>
<copy file="${basedir}/src/main/build/docker/Dockerfile"
tofile="${project.build.directory}/build/Dockerfile"/>
</tasks>
</configuration>
</execution>

View File

@ -0,0 +1,9 @@
FROM openjdk:8
ADD novel-admin.jar /root
ENV dburl=""
ENV username=""
ENV password=""
ENV redishost = ""
ENV redisport = ""
ENV redispwd = ""
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -Dspring.redis.host=${redishost} -Dspring.redis.port=${redisport} -Dspring.redis.password=${redispwd} -jar /root/novel-admin.jar"]

View File

@ -68,6 +68,7 @@ public class ShiroConfig {
filterChainDefinitionMap.put("/js/**", "anon");
filterChainDefinitionMap.put("/fonts/**", "anon");
filterChainDefinitionMap.put("/img/**", "anon");
filterChainDefinitionMap.put("/favicon.ico", "anon");
filterChainDefinitionMap.put("/docs/**", "anon");
filterChainDefinitionMap.put("/layuimini/**", "anon");
filterChainDefinitionMap.put("/upload/**", "anon");

View File

@ -12,6 +12,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -83,7 +84,7 @@ public class FriendLinkController {
@ResponseBody
@PostMapping("/save")
@RequiresPermissions("novel:friendLink:add")
public R save(FriendLinkDO friendLink) {
public R save(@Validated FriendLinkDO friendLink) {
if (friendLinkService.save(friendLink) > 0) {
redisTemplate.delete(CacheKey.INDEX_LINK_KEY);
return R.ok();
@ -98,7 +99,7 @@ public class FriendLinkController {
@ResponseBody
@RequestMapping("/update")
@RequiresPermissions("novel:friendLink:edit")
public R update(FriendLinkDO friendLink) {
public R update(@Validated FriendLinkDO friendLink) {
friendLinkService.update(friendLink);
redisTemplate.delete(CacheKey.INDEX_LINK_KEY);
return R.ok();

View File

@ -1,163 +1,175 @@
package com.java2nb.novel.domain;
import java.io.Serializable;
import java.math.BigDecimal;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.java2nb.common.jsonserializer.LongToStringSerializer;
import org.hibernate.validator.constraints.URL;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
*
*
* @author xiongxy
* @email 1179705413@qq.com
* @date 2023-04-14 15:12:25
*/
public class FriendLinkDO implements Serializable {
private static final long serialVersionUID = 1L;
//主键
private Integer id;
//链接名
private String linkName;
//链接url
private String linkUrl;
//排序号
private Integer sort;
//是否开启0不开启1开启
private Integer isOpen;
//创建人id
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long createUserId;
//创建时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//更新者用户id
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long updateUserId;
//更新时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
private static final long serialVersionUID = 1L;
/**
* 设置:主键
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:主键
*/
public Integer getId() {
return id;
}
/**
* 设置:链接名
*/
public void setLinkName(String linkName) {
this.linkName = linkName;
}
/**
* 获取:链接名
*/
public String getLinkName() {
return linkName;
}
/**
* 设置链接url
*/
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
/**
* 获取链接url
*/
public String getLinkUrl() {
return linkUrl;
}
/**
* 设置:排序号
*/
public void setSort(Integer sort) {
this.sort = sort;
}
/**
* 获取:排序号
*/
public Integer getSort() {
return sort;
}
/**
* 设置是否开启0不开启1开启
*/
public void setIsOpen(Integer isOpen) {
this.isOpen = isOpen;
}
/**
* 获取是否开启0不开启1开启
*/
public Integer getIsOpen() {
return isOpen;
}
/**
* 设置创建人id
*/
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* 获取创建人id
*/
public Long getCreateUserId() {
return createUserId;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置更新者用户id
*/
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
/**
* 获取更新者用户id
*/
public Long getUpdateUserId() {
return updateUserId;
}
/**
* 设置:更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
//主键
private Integer id;
//链接名
private String linkName;
//链接url
@URL
private String linkUrl;
//排序号
private Integer sort;
//是否开启0不开启1开启
private Integer isOpen;
//创建人id
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long createUserId;
//创建时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
//更新者用户id
//java中的long能表示的范围比js中number大,也就意味着部分数值在js中存不下(变成不准确的值)
//所以通过序列化成字符串来解决
@JsonSerialize(using = LongToStringSerializer.class)
private Long updateUserId;
//更新时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 设置:主键
*/
public void setId(Integer id) {
this.id = id;
}
/**
* 获取:主键
*/
public Integer getId() {
return id;
}
/**
* 设置:链接名
*/
public void setLinkName(String linkName) {
this.linkName = linkName;
}
/**
* 获取:链接名
*/
public String getLinkName() {
return linkName;
}
/**
* 设置链接url
*/
public void setLinkUrl(String linkUrl) {
this.linkUrl = linkUrl;
}
/**
* 获取链接url
*/
public String getLinkUrl() {
return linkUrl;
}
/**
* 设置:排序号
*/
public void setSort(Integer sort) {
this.sort = sort;
}
/**
* 获取:排序号
*/
public Integer getSort() {
return sort;
}
/**
* 设置是否开启0不开启1开启
*/
public void setIsOpen(Integer isOpen) {
this.isOpen = isOpen;
}
/**
* 获取是否开启0不开启1开启
*/
public Integer getIsOpen() {
return isOpen;
}
/**
* 设置创建人id
*/
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
/**
* 获取创建人id
*/
public Long getCreateUserId() {
return createUserId;
}
/**
* 设置:创建时间
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* 获取:创建时间
*/
public Date getCreateTime() {
return createTime;
}
/**
* 设置更新者用户id
*/
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
/**
* 获取更新者用户id
*/
public Long getUpdateUserId() {
return updateUserId;
}
/**
* 设置:更新时间
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
/**
* 获取:更新时间
*/
public Date getUpdateTime() {
return updateTime;
}
}

View File

@ -18,11 +18,12 @@ spring:
profiles:
active: dev
#上传文件的最大值10M
#上传文件的最大值100M
servlet:
multipart:
max-file-size: 10485760
max-file-size: 100MB
max-request-size: 100MB
devtools:
restart:
enabled: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -23,7 +23,7 @@
<div class="col-sm-8">
<input id="linkUrl" name="linkUrl"
class="form-control"
type="text" required>
type="url" required>
</div>
</div>

View File

@ -26,7 +26,7 @@
<input id="linkUrl" name="linkUrl"
th:value="${friendLink.linkUrl}"
class="form-control"
type="text" required>
type="url" required>
</div>
</div>
<div class="form-group">

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>4.2.0</version>
<version>4.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>

View File

@ -14,7 +14,10 @@ import org.springframework.http.ResponseEntity;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Date;
import java.util.Objects;
@ -37,10 +40,13 @@ public class FileUtil {
//本地图片保存
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<Resource> resEntity = RestTemplateUtil.getInstance(Charsets.ISO_8859_1.name()).exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
ResponseEntity<Resource> resEntity = RestTemplates.newInstance(Charsets.ISO_8859_1.name())
.exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
input = Objects.requireNonNull(resEntity.getBody()).getInputStream();
Date currentDate = new Date();
picSrc = visitPrefix + DateUtils.formatDate(currentDate, "yyyy") + "/" + DateUtils.formatDate(currentDate, "MM") + "/" + DateUtils.formatDate(currentDate, "dd") + "/"
picSrc =
visitPrefix + DateUtils.formatDate(currentDate, "yyyy") + "/" + DateUtils.formatDate(currentDate, "MM")
+ "/" + DateUtils.formatDate(currentDate, "dd") + "/"
+ UUIDUtil.getUUID32()
+ picSrc.substring(picSrc.lastIndexOf("."));
File picFile = new File(picSavePath + picSrc);
@ -67,7 +73,6 @@ public class FileUtil {
closeStream(input, out);
}
return picSrc;
}

View File

@ -1,38 +1,24 @@
package com.java2nb.novel.core.utils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.*;
import org.springframework.web.client.RestTemplate;
/**
* @author Administrator
*/
@Slf4j
public class HttpUtil {
private static RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
public static String getByHttpClient(String url) {
try {
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
return forEntity.getBody();
} else {
return null;
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
private static final RestTemplate REST_TEMPLATE = RestTemplates.newInstance("utf-8");
public static String getByHttpClientWithChrome(String url) {
try {
HttpHeaders headers = new HttpHeaders();
headers.add("user-agent","Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36");
headers.add("user-agent",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.67 Safari/537.36");
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<String> forEntity = restTemplate.exchange(url.toString(), HttpMethod.GET, requestEntity, String.class);
ResponseEntity<String> forEntity = REST_TEMPLATE.exchange(url, HttpMethod.GET, requestEntity, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
return forEntity.getBody();
@ -40,8 +26,9 @@ public class HttpUtil {
return null;
}
} catch (Exception e) {
e.printStackTrace();
log.error(e.getMessage(), e);
return null;
}
}
}

View File

@ -26,16 +26,16 @@ import java.util.List;
import java.util.Objects;
@Component
public class RestTemplateUtil {
public class RestTemplates {
private static HttpProxyProperties httpProxyProperties;
RestTemplateUtil(HttpProxyProperties properties) {
RestTemplates(HttpProxyProperties properties) {
httpProxyProperties = properties;
}
@SneakyThrows
public static RestTemplate getInstance(String charset) {
public static RestTemplate newInstance(String charset) {
TrustStrategy acceptingTrustStrategy = (X509Certificate[] chain, String authType) -> true;

View File

@ -14,43 +14,48 @@ public class User {
private Long id;
@NotBlank(groups = {AddGroup.class},message="手机号不能为空!")
@Pattern(groups = {AddGroup.class},regexp="^1[3|4|5|6|7|8|9][0-9]{9}$",message="手机号格式不正确!")
@NotBlank(groups = {AddGroup.class}, message = "手机号不能为空!")
@Pattern(groups = {AddGroup.class}, regexp = "^1[3|4|5|6|7|8|9][0-9]{9}$", message = "手机号格式不正确!")
@Null(groups = {UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String username;
@NotBlank(groups = {AddGroup.class},message="密码不能为空!")
@NotBlank(groups = {AddGroup.class}, message = "密码不能为空!")
@Null(groups = {UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String password;
@Null(groups = {AddGroup.class})
@Pattern(groups = {
UpdateGroup.class}, regexp = "[\u4E00-\u9FA5A-Za-z0-9_]{1,11}", message = "昵称格式不正确!")
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String nickName;
@Null(groups = {AddGroup.class})
@Pattern(groups = {
UpdateGroup.class}, regexp = "^/localPic/\\d{4}/\\d{2}/\\d{2}/[A-Za-z0-9]+\\.(jpg|jpeg|swf|gif|png|JPG|JPEG|SWF|GIF|PNG)$", message = "只能上传图片格式的文件!")
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private String userPhoto;
@Null(groups = {AddGroup.class})
@Min(value = 0,groups = {UpdateGroup.class})
@Max(value = 1,groups = {UpdateGroup.class})
@Min(value = 0, groups = {UpdateGroup.class})
@Max(value = 1, groups = {UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte userSex;
@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Long accountBalance;
@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Byte status;
@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date createTime;
@Null(groups = {AddGroup.class,UpdateGroup.class})
@Null(groups = {AddGroup.class, UpdateGroup.class})
@Generated("org.mybatis.generator.api.MyBatisGenerator")
private Date updateTime;

View File

@ -11,10 +11,11 @@ spring:
generator:
write-numbers-as-strings: true
#上传文件的最大值1M
#上传文件的最大值100M
servlet:
multipart:
max-file-size: 1048576
max-file-size: 100MB
max-request-size: 100MB
mybatis:
configuration:

View File

@ -1,6 +0,0 @@
FROM java:8
ADD novel-crawl-1.1.0.jar /root
ENV dburl=""
ENV username=""
ENV password=""
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -jar /root/novel-crawl-1.1.0.jar"]

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>novel</artifactId>
<groupId>com.java2nb</groupId>
<version>4.2.0</version>
<version>4.4.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -72,6 +72,9 @@
<zip destfile='${project.build.directory}/build/${project.artifactId}.zip'>
<zipfileset filemode="755" dir='${project.build.directory}/build/'/>
</zip>
<copy file="${basedir}/src/main/build/docker/Dockerfile"
tofile="${project.build.directory}/build/Dockerfile"/>
</tasks>
</configuration>
</execution>

View File

@ -0,0 +1,9 @@
FROM openjdk:8
ADD novel-crawl.jar /root
ENV dburl=""
ENV username=""
ENV password=""
ENV redishost = ""
ENV redisport = ""
ENV redispwd = ""
ENTRYPOINT ["sh","-c","java -Dspring.datasource.url=${dburl} -Dspring.datasource.username=${username} -Dspring.datasource.password=${password} -Dspring.redis.host=${redishost} -Dspring.redis.port=${redisport} -Dspring.redis.password=${redispwd} -jar /root/novel-crawl.jar"]

View File

@ -53,8 +53,12 @@ public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
http.csrf().disable()
.authorizeRequests()
.antMatchers("/css/**").permitAll()
.antMatchers("/favicon.ico").permitAll()
.antMatchers("/**").hasRole("ADMIN")
.and().formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll()
.and().logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/")
.and().httpBasic();
}

View File

@ -1,23 +1,23 @@
package com.java2nb.novel.core.crawl;
import com.java2nb.novel.core.utils.HttpUtil;
import com.java2nb.novel.core.utils.RandomBookInfoUtil;
import com.java2nb.novel.core.utils.RestTemplateUtil;
import com.java2nb.novel.core.utils.StringUtil;
import com.java2nb.novel.entity.Book;
import com.java2nb.novel.entity.BookContent;
import com.java2nb.novel.entity.BookIndex;
import com.java2nb.novel.utils.Constants;
import com.java2nb.novel.utils.CrawlHttpClient;
import io.github.xxyopen.util.IdWorker;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@ -26,20 +26,19 @@ import java.util.regex.Pattern;
*
* @author Administrator
*/
@Slf4j
@Component
@RequiredArgsConstructor
public class CrawlParser {
private static final IdWorker idWorker = IdWorker.INSTANCE;
private final IdWorker ID_WORKER = IdWorker.INSTANCE;
private static final RestTemplate restTemplate = RestTemplateUtil.getInstance("utf-8");
private static final ThreadLocal<Integer> retryCount = new ThreadLocal<>();
private final CrawlHttpClient crawlHttpClient;
@SneakyThrows
public static void parseBook(RuleBean ruleBean, String bookId, CrawlBookHandler handler) {
public void parseBook(RuleBean ruleBean, String bookId, CrawlBookHandler handler) {
Book book = new Book();
String bookDetailUrl = ruleBean.getBookDetailUrl().replace("{bookId}", bookId);
String bookDetailHtml = getByHttpClientWithChrome(bookDetailUrl);
String bookDetailHtml = crawlHttpClient.get(bookDetailUrl);
if (bookDetailHtml != null) {
Pattern bookNamePatten = PatternFactory.getPattern(ruleBean.getBookNamePatten());
Matcher bookNameMatch = bookNamePatten.matcher(bookDetailHtml);
@ -89,14 +88,15 @@ 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.replaceAll("<a[^<]+</a>", "")
.replaceAll("<font[^<]+</font>", "")
.replaceAll("<p>\\s*</p>", "")
.replaceAll("<p>", "")
.replaceAll("</p>", "<br/>");
.replaceAll("<font[^<]+</font>", "")
.replaceAll("<p>\\s*</p>", "")
.replaceAll("<p>", "")
.replaceAll("</p>", "<br/>");
//设置书籍简介
book.setBookDesc(desc);
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
@ -112,14 +112,16 @@ public class CrawlParser {
}
}
if (StringUtils.isNotBlank(ruleBean.getUpadateTimePatten()) && StringUtils.isNotBlank(ruleBean.getUpadateTimeFormatPatten())) {
if (StringUtils.isNotBlank(ruleBean.getUpadateTimePatten()) && StringUtils.isNotBlank(
ruleBean.getUpadateTimeFormatPatten())) {
Pattern updateTimePatten = PatternFactory.getPattern(ruleBean.getUpadateTimePatten());
Matcher updateTimeMatch = updateTimePatten.matcher(bookDetailHtml);
boolean isFindUpdateTime = updateTimeMatch.find();
if (isFindUpdateTime) {
String updateTime = updateTimeMatch.group(1);
//设置更新时间
book.setLastIndexUpdateTime(new SimpleDateFormat(ruleBean.getUpadateTimeFormatPatten()).parse(updateTime));
book.setLastIndexUpdateTime(
new SimpleDateFormat(ruleBean.getUpadateTimeFormatPatten()).parse(updateTime));
}
}
@ -141,7 +143,8 @@ public class CrawlParser {
handler.handle(book);
}
public static boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean, Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) {
public boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean,
Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) {
Date currentDate = new Date();
@ -149,11 +152,12 @@ public class CrawlParser {
List<BookContent> contentList = new ArrayList<>();
//读取目录
String indexListUrl = ruleBean.getBookIndexUrl().replace("{bookId}", sourceBookId);
String indexListHtml = getByHttpClientWithChrome(indexListUrl);
String indexListHtml = crawlHttpClient.get(indexListUrl);
if (indexListHtml != null) {
if (StringUtils.isNotBlank(ruleBean.getBookIndexStart())) {
indexListHtml = indexListHtml.substring(indexListHtml.indexOf(ruleBean.getBookIndexStart()) + ruleBean.getBookIndexStart().length());
indexListHtml = indexListHtml.substring(
indexListHtml.indexOf(ruleBean.getBookIndexStart()) + ruleBean.getBookIndexStart().length());
}
Pattern indexIdPatten = PatternFactory.getPattern(ruleBean.getIndexIdPatten());
@ -174,14 +178,16 @@ public class CrawlParser {
BookIndex hasIndex = existBookIndexMap.get(indexNum);
String indexName = indexNameMatch.group(1);
if (hasIndex == null || !StringUtils.deleteWhitespace(hasIndex.getIndexName()).equals(StringUtils.deleteWhitespace(indexName))) {
if (hasIndex == null || !StringUtils.deleteWhitespace(hasIndex.getIndexName())
.equals(StringUtils.deleteWhitespace(indexName))) {
String sourceIndexId = indexIdMatch.group(1);
String bookContentUrl = ruleBean.getBookContentUrl();
int calStart = bookContentUrl.indexOf("{cal_");
if (calStart != -1) {
//内容页URL需要进行计算才能得到
String calStr = bookContentUrl.substring(calStart, calStart + bookContentUrl.substring(calStart).indexOf("}"));
String calStr = bookContentUrl.substring(calStart,
calStart + bookContentUrl.substring(calStart).indexOf("}"));
String[] calArr = calStr.split("_");
int calType = Integer.parseInt(calArr[1]);
if (calType == 1) {
@ -206,13 +212,25 @@ public class CrawlParser {
}
String contentUrl = bookContentUrl.replace("{bookId}", sourceBookId).replace("{indexId}", sourceIndexId);
String contentUrl = bookContentUrl.replace("{bookId}", sourceBookId)
.replace("{indexId}", sourceIndexId);
//查询章节内容
String contentHtml = getByHttpClientWithChrome(contentUrl);
String contentHtml = crawlHttpClient.get(contentUrl);
if (contentHtml != null && !contentHtml.contains("正在手打中")) {
String content = contentHtml.substring(contentHtml.indexOf(ruleBean.getContentStart()) + ruleBean.getContentStart().length());
String content = contentHtml.substring(
contentHtml.indexOf(ruleBean.getContentStart()) + ruleBean.getContentStart().length());
content = content.substring(0, content.indexOf(ruleBean.getContentEnd()));
// 小说内容过滤
String filterContent = ruleBean.getFilterContent();
if (StringUtils.isNotBlank(filterContent)) {
String[] filterRules = filterContent.replace("\r\n", "\n").split("\n");
for (String filterRule : filterRules) {
if (StringUtils.isNotBlank(filterRule)) {
content = content.replaceAll(filterRule, "");
}
}
}
//插入章节目录和章节内容
BookIndex bookIndex = new BookIndex();
bookIndex.setIndexName(indexName);
@ -235,7 +253,7 @@ public class CrawlParser {
} else {
//章节插入
//设置目录和章节内容
Long indexId = idWorker.nextId();
Long indexId = ID_WORKER.nextId();
bookIndex.setId(indexId);
bookIndex.setBookId(book.getId());
@ -257,7 +275,6 @@ public class CrawlParser {
isFindIndex = indexIdMatch.find() & indexNameMatch.find();
}
if (indexList.size() > 0) {
//如果有爬到最新章节,则设置小说主表的最新章节信息
//获取爬取到的最新章节
@ -290,56 +307,4 @@ public class CrawlParser {
return false;
}
private static String getByHttpClient(String url) {
try {
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class);
if (forEntity.getStatusCode() == HttpStatus.OK) {
String body = forEntity.getBody();
assert body != null;
if (body.length() < Constants.INVALID_HTML_LENGTH) {
return processErrorHttpResult(url);
}
//成功获得html内容
return body;
}
} catch (Exception e) {
e.printStackTrace();
}
return processErrorHttpResult(url);
}
private static String getByHttpClientWithChrome(String url) {
try {
String body = HttpUtil.getByHttpClientWithChrome(url);
if (body != null && body.length() < Constants.INVALID_HTML_LENGTH) {
return processErrorHttpResult(url);
}
//成功获得html内容
return body;
} catch (Exception e) {
e.printStackTrace();
}
return processErrorHttpResult(url);
}
@SneakyThrows
private static String processErrorHttpResult(String url) {
Integer count = retryCount.get();
if (count == null) {
count = 0;
}
if (count < Constants.HTTP_FAIL_RETRY_COUNT) {
Thread.sleep(new Random().nextInt(10 * 1000));
retryCount.set(++count);
return getByHttpClient(url);
}
return null;
}
}

View File

@ -6,6 +6,7 @@ import java.util.Map;
/**
* 爬虫解析规则bean
*
* @author Administrator
*/
@Data
@ -13,17 +14,17 @@ public class RuleBean {
/**
* 小说更新列表url
* */
*/
private String updateBookListUrl;
/**
* 分类列表页URL规则
* */
*/
private String bookListUrl;
private Map<String,String> catIdRule;
private Map<String, String> catIdRule;
private Map<String,Byte> bookStatusRule;
private Map<String, Byte> bookStatusRule;
private String bookIdPatten;
private String pagePatten;
@ -51,5 +52,7 @@ public class RuleBean {
private String bookIndexStart;
private String filterContent;
}

View File

@ -1,10 +1,12 @@
package com.java2nb.novel.core.listener;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.java2nb.novel.core.crawl.ChapterBean;
import com.java2nb.novel.core.crawl.CrawlParser;
import com.java2nb.novel.core.crawl.RuleBean;
import com.java2nb.novel.entity.*;
import com.java2nb.novel.entity.Book;
import com.java2nb.novel.entity.BookIndex;
import com.java2nb.novel.entity.CrawlSingleTask;
import com.java2nb.novel.entity.CrawlSource;
import com.java2nb.novel.service.BookService;
import com.java2nb.novel.service.CrawlService;
import com.java2nb.novel.utils.Constants;
@ -33,6 +35,8 @@ public class StarterListener implements ServletContextListener {
private final CrawlService crawlService;
private final CrawlParser crawlParser;
@Value("${crawl.update.thread}")
private int updateThreadCount;
@ -56,20 +60,24 @@ public class StarterListener implements ServletContextListener {
CrawlSource source = crawlService.queryCrawlSource(needUpdateBook.getCrawlSourceId());
RuleBean ruleBean = new ObjectMapper().readValue(source.getCrawlRule(), RuleBean.class);
//解析小说基本信息
CrawlParser.parseBook(ruleBean, needUpdateBook.getCrawlBookId(),book -> {
crawlParser.parseBook(ruleBean, needUpdateBook.getCrawlBookId(), book -> {
//这里只做老书更新
book.setId(needUpdateBook.getId());
book.setWordCount(needUpdateBook.getWordCount());
if (needUpdateBook.getPicUrl() != null && needUpdateBook.getPicUrl().contains(Constants.LOCAL_PIC_PREFIX)) {
if (needUpdateBook.getPicUrl() != null && needUpdateBook.getPicUrl()
.contains(Constants.LOCAL_PIC_PREFIX)) {
//本地图片则不更新
book.setPicUrl(null);
}
//查询已存在的章节
Map<Integer, BookIndex> existBookIndexMap = bookService.queryExistBookIndexMap(needUpdateBook.getId());
Map<Integer, BookIndex> existBookIndexMap = bookService.queryExistBookIndexMap(
needUpdateBook.getId());
//解析章节目录
CrawlParser.parseBookIndexAndContent(needUpdateBook.getCrawlBookId(), book, ruleBean, existBookIndexMap,chapter -> {
bookService.updateBookAndIndexAndContent(book, chapter.getBookIndexList(), chapter.getBookContentList(), existBookIndexMap);
});
crawlParser.parseBookIndexAndContent(needUpdateBook.getCrawlBookId(), book,
ruleBean, existBookIndexMap, chapter -> {
bookService.updateBookAndIndexAndContent(book, chapter.getBookIndexList(),
chapter.getBookContentList(), existBookIndexMap);
});
});
} catch (Exception e) {
log.error(e.getMessage(), e);
@ -88,7 +96,6 @@ public class StarterListener implements ServletContextListener {
}
new Thread(() -> {
log.info("程序启动,开始执行单本采集任务线程。。。");
while (true) {
@ -103,7 +110,8 @@ public class StarterListener implements ServletContextListener {
CrawlSource source = crawlService.queryCrawlSource(task.getSourceId());
RuleBean ruleBean = new ObjectMapper().readValue(source.getCrawlRule(), RuleBean.class);
if (crawlService.parseBookAndSave(task.getCatId(), ruleBean, task.getSourceId(), task.getSourceBookId())) {
if (crawlService.parseBookAndSave(task.getCatId(), ruleBean, task.getSourceId(),
task.getSourceBookId())) {
//采集成功
crawlStatus = 1;
}

View File

@ -2,17 +2,11 @@ package com.java2nb.novel.service.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.pagehelper.PageHelper;
import io.github.xxyopen.model.page.PageBean;
import com.java2nb.novel.core.cache.CacheKey;
import com.java2nb.novel.core.cache.CacheService;
import com.java2nb.novel.core.crawl.CrawlParser;
import com.java2nb.novel.core.crawl.RuleBean;
import com.java2nb.novel.core.enums.ResponseStatus;
import io.github.xxyopen.model.page.builder.pagehelper.PageBuilder;
import io.github.xxyopen.util.IdWorker;
import io.github.xxyopen.util.ThreadUtil;
import io.github.xxyopen.web.exception.BusinessException;
import io.github.xxyopen.web.util.BeanUtil;
import com.java2nb.novel.entity.Book;
import com.java2nb.novel.entity.CrawlSingleTask;
import com.java2nb.novel.entity.CrawlSource;
@ -22,8 +16,15 @@ import com.java2nb.novel.mapper.CrawlSourceDynamicSqlSupport;
import com.java2nb.novel.mapper.CrawlSourceMapper;
import com.java2nb.novel.service.BookService;
import com.java2nb.novel.service.CrawlService;
import com.java2nb.novel.utils.CrawlHttpClient;
import com.java2nb.novel.vo.CrawlSingleTaskVO;
import com.java2nb.novel.vo.CrawlSourceVO;
import io.github.xxyopen.model.page.PageBean;
import io.github.xxyopen.model.page.builder.pagehelper.PageBuilder;
import io.github.xxyopen.util.IdWorker;
import io.github.xxyopen.util.ThreadUtil;
import io.github.xxyopen.web.exception.BusinessException;
import io.github.xxyopen.web.util.BeanUtil;
import io.github.xxyopen.web.util.SpringUtil;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
@ -38,7 +39,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import static com.java2nb.novel.core.utils.HttpUtil.getByHttpClientWithChrome;
import static com.java2nb.novel.mapper.CrawlSourceDynamicSqlSupport.*;
import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
import static org.mybatis.dynamic.sql.select.SelectDSL.select;
@ -51,6 +51,7 @@ import static org.mybatis.dynamic.sql.select.SelectDSL.select;
@Slf4j
public class CrawlServiceImpl implements CrawlService {
private final CrawlParser crawlParser;
private final CrawlSourceMapper crawlSourceMapper;
@ -62,6 +63,8 @@ public class CrawlServiceImpl implements CrawlService {
private final IdWorker idWorker = IdWorker.INSTANCE;
private final CrawlHttpClient crawlHttpClient;
@Override
public void addCrawlSource(CrawlSource source) {
@ -71,15 +74,16 @@ public class CrawlServiceImpl implements CrawlService {
crawlSourceMapper.insertSelective(source);
}
@Override
public void updateCrawlSource(CrawlSource source) {
if(source.getId()!=null){
Optional<CrawlSource> opt=crawlSourceMapper.selectByPrimaryKey(source.getId());
if(opt.isPresent()) {
CrawlSource crawlSource =opt.get();
if (source.getId() != null) {
Optional<CrawlSource> opt = crawlSourceMapper.selectByPrimaryKey(source.getId());
if (opt.isPresent()) {
CrawlSource crawlSource = opt.get();
if (crawlSource.getSourceStatus() == (byte) 1) {
//关闭
openOrCloseCrawl(crawlSource.getId(),(byte)0);
openOrCloseCrawl(crawlSource.getId(), (byte) 0);
}
Date currentDate = new Date();
crawlSource.setUpdateTime(currentDate);
@ -89,14 +93,15 @@ public class CrawlServiceImpl implements CrawlService {
}
}
}
@Override
public PageBean<CrawlSource> listCrawlByPage(int page, int pageSize) {
PageHelper.startPage(page, pageSize);
SelectStatementProvider render = select(id, sourceName, sourceStatus, createTime, updateTime)
.from(crawlSource)
.orderBy(updateTime)
.build()
.render(RenderingStrategies.MYBATIS3);
.from(crawlSource)
.orderBy(updateTime)
.build()
.render(RenderingStrategies.MYBATIS3);
List<CrawlSource> crawlSources = crawlSourceMapper.selectMany(render);
PageBean<CrawlSource> pageBean = PageBuilder.build(crawlSources);
pageBean.setList(BeanUtil.copyList(crawlSources, CrawlSourceVO.class));
@ -113,7 +118,8 @@ public class CrawlServiceImpl implements CrawlService {
if (sourceStatus == (byte) 0) {
//关闭,直接修改数据库状态,并直接修改数据库状态后获取该爬虫正在运行的线程集合全部停止
SpringUtil.getBean(CrawlService.class).updateCrawlSourceStatus(sourceId, sourceStatus);
Set<Long> runningCrawlThreadId = (Set<Long>) cacheService.getObject(CacheKey.RUNNING_CRAWL_THREAD_KEY_PREFIX + sourceId);
Set<Long> runningCrawlThreadId = (Set<Long>) cacheService.getObject(
CacheKey.RUNNING_CRAWL_THREAD_KEY_PREFIX + sourceId);
if (runningCrawlThreadId != null) {
for (Long ThreadId : runningCrawlThreadId) {
Thread thread = ThreadUtil.findThread(ThreadId);
@ -157,11 +163,12 @@ public class CrawlServiceImpl implements CrawlService {
@Override
public CrawlSource queryCrawlSource(Integer sourceId) {
SelectStatementProvider render = select(CrawlSourceDynamicSqlSupport.sourceStatus, CrawlSourceDynamicSqlSupport.crawlRule)
.from(crawlSource)
.where(id, isEqualTo(sourceId))
.build()
.render(RenderingStrategies.MYBATIS3);
SelectStatementProvider render = select(CrawlSourceDynamicSqlSupport.sourceStatus,
CrawlSourceDynamicSqlSupport.crawlRule)
.from(crawlSource)
.where(id, isEqualTo(sourceId))
.build()
.render(RenderingStrategies.MYBATIS3);
return crawlSourceMapper.selectMany(render).get(0);
}
@ -182,10 +189,10 @@ public class CrawlServiceImpl implements CrawlService {
public PageBean<CrawlSingleTask> listCrawlSingleTaskByPage(int page, int pageSize) {
PageHelper.startPage(page, pageSize);
SelectStatementProvider render = select(CrawlSingleTaskDynamicSqlSupport.crawlSingleTask.allColumns())
.from(CrawlSingleTaskDynamicSqlSupport.crawlSingleTask)
.orderBy(CrawlSingleTaskDynamicSqlSupport.createTime.descending())
.build()
.render(RenderingStrategies.MYBATIS3);
.from(CrawlSingleTaskDynamicSqlSupport.crawlSingleTask)
.orderBy(CrawlSingleTaskDynamicSqlSupport.createTime.descending())
.build()
.render(RenderingStrategies.MYBATIS3);
List<CrawlSingleTask> crawlSingleTasks = crawlSingleTaskMapper.selectMany(render);
PageBean<CrawlSingleTask> pageBean = PageBuilder.build(crawlSingleTasks);
pageBean.setList(BeanUtil.copyList(crawlSingleTasks, CrawlSingleTaskVO.class));
@ -200,7 +207,8 @@ public class CrawlServiceImpl implements CrawlService {
@Override
public CrawlSingleTask getCrawlSingleTask() {
List<CrawlSingleTask> list = crawlSingleTaskMapper.selectMany(select(CrawlSingleTaskDynamicSqlSupport.crawlSingleTask.allColumns())
List<CrawlSingleTask> list = crawlSingleTaskMapper.selectMany(
select(CrawlSingleTaskDynamicSqlSupport.crawlSingleTask.allColumns())
.from(CrawlSingleTaskDynamicSqlSupport.crawlSingleTask)
.where(CrawlSingleTaskDynamicSqlSupport.taskStatus, isEqualTo((byte) 2))
.orderBy(CrawlSingleTaskDynamicSqlSupport.createTime)
@ -226,12 +234,12 @@ public class CrawlServiceImpl implements CrawlService {
@Override
public CrawlSource getCrawlSource(Integer id) {
Optional<CrawlSource> opt=crawlSourceMapper.selectByPrimaryKey(id);
if(opt.isPresent()) {
CrawlSource crawlSource =opt.get();
return crawlSource;
}
return null;
Optional<CrawlSource> opt = crawlSourceMapper.selectByPrimaryKey(id);
if (opt.isPresent()) {
CrawlSource crawlSource = opt.get();
return crawlSource;
}
return null;
}
/**
@ -251,10 +259,10 @@ public class CrawlServiceImpl implements CrawlService {
if (StringUtils.isNotBlank(ruleBean.getCatIdRule().get("catId" + catId))) {
//拼接分类URL
String catBookListUrl = ruleBean.getBookListUrl()
.replace("{catId}", ruleBean.getCatIdRule().get("catId" + catId))
.replace("{page}", page + "");
.replace("{catId}", ruleBean.getCatIdRule().get("catId" + catId))
.replace("{page}", page + "");
String bookListHtml = getByHttpClientWithChrome(catBookListUrl);
String bookListHtml = crawlHttpClient.get(catBookListUrl);
if (bookListHtml != null) {
Pattern bookIdPatten = Pattern.compile(ruleBean.getBookIdPatten());
Matcher bookIdMatcher = bookIdPatten.matcher(bookListHtml);
@ -268,14 +276,12 @@ public class CrawlServiceImpl implements CrawlService {
return;
}
String bookId = bookIdMatcher.group(1);
parseBookAndSave(catId, ruleBean, sourceId, bookId);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
isFindBookId = bookIdMatcher.find();
}
@ -306,7 +312,7 @@ public class CrawlServiceImpl implements CrawlService {
final AtomicBoolean parseResult = new AtomicBoolean(false);
CrawlParser.parseBook(ruleBean, bookId, book -> {
crawlParser.parseBook(ruleBean, bookId, book -> {
if (book.getBookName() == null || book.getAuthorName() == null) {
return;
}
@ -330,9 +336,11 @@ public class CrawlServiceImpl implements CrawlService {
book.setCrawlLastTime(new Date());
book.setId(idWorker.nextId());
//解析章节目录
boolean parseIndexContentResult = CrawlParser.parseBookIndexAndContent(bookId, book, ruleBean, new HashMap<>(0), chapter -> {
bookService.saveBookAndIndexAndContent(book, chapter.getBookIndexList(), chapter.getBookContentList());
});
boolean parseIndexContentResult = crawlParser.parseBookIndexAndContent(bookId, book, ruleBean,
new HashMap<>(0), chapter -> {
bookService.saveBookAndIndexAndContent(book, chapter.getBookIndexList(),
chapter.getBookContentList());
});
parseResult.set(parseIndexContentResult);
} else {
@ -356,11 +364,12 @@ public class CrawlServiceImpl implements CrawlService {
@Override
public List<CrawlSource> queryCrawlSourceByStatus(Byte sourceStatus) {
SelectStatementProvider render = select(CrawlSourceDynamicSqlSupport.id, CrawlSourceDynamicSqlSupport.sourceStatus, CrawlSourceDynamicSqlSupport.crawlRule)
.from(crawlSource)
.where(CrawlSourceDynamicSqlSupport.sourceStatus, isEqualTo(sourceStatus))
.build()
.render(RenderingStrategies.MYBATIS3);
SelectStatementProvider render = select(CrawlSourceDynamicSqlSupport.id,
CrawlSourceDynamicSqlSupport.sourceStatus, CrawlSourceDynamicSqlSupport.crawlRule)
.from(crawlSource)
.where(CrawlSourceDynamicSqlSupport.sourceStatus, isEqualTo(sourceStatus))
.build()
.render(RenderingStrategies.MYBATIS3);
return crawlSourceMapper.selectMany(render);
}
}

View File

@ -7,7 +7,7 @@ public class Constants {
/**
* 本地图片保存前缀
* */
*/
public static final String LOCAL_PIC_PREFIX = "/localPic/";
/**
@ -23,5 +23,5 @@ public class Constants {
/**
* 爬取小说http请求失败重试次数
*/
public static final Integer HTTP_FAIL_RETRY_COUNT = 5;
public static final Integer HTTP_FAIL_RETRY_COUNT = 3;
}

View File

@ -0,0 +1,57 @@
package com.java2nb.novel.utils;
import com.java2nb.novel.core.utils.HttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Objects;
import java.util.Random;
/**
* @author Administrator
*/
@Slf4j
@Component
public class CrawlHttpClient {
@Value("${crawl.interval.min}")
private Integer intervalMin;
@Value("${crawl.interval.max}")
private Integer intervalMax;
private final Random random = new Random();
private static final ThreadLocal<Integer> RETRY_COUNT = new ThreadLocal<>();
public String get(String url) {
if (Objects.nonNull(intervalMin) && Objects.nonNull(intervalMax) && intervalMax > intervalMin) {
try {
Thread.sleep(random.nextInt(intervalMax - intervalMin + 1) + intervalMin);
} catch (InterruptedException e) {
log.error(e.getMessage(), e);
}
}
String body = HttpUtil.getByHttpClientWithChrome(url);
if (Objects.isNull(body) || body.length() < Constants.INVALID_HTML_LENGTH) {
return processErrorHttpResult(url);
}
//成功获得html内容
return body;
}
private String processErrorHttpResult(String url) {
Integer count = RETRY_COUNT.get();
if (count == null) {
count = 0;
}
if (count < Constants.HTTP_FAIL_RETRY_COUNT) {
RETRY_COUNT.set(++count);
return get(url);
}
RETRY_COUNT.remove();
return null;
}
}

View File

@ -14,12 +14,18 @@ admin:
username: admin
password: admin
#爬虫自动更新的线程数
#建议小说数量不多或者正在运行新书入库爬虫的情况下设置为1即可
#随着小说数量的增多可以逐渐增加但建议不要超出CPU的线程数
crawl:
update:
#爬虫自动更新的线程数
#建议小说数量不多或者正在运行新书入库爬虫的情况下设置为1即可
#随着小说数量的增多可以逐渐增加但建议不要超出CPU的线程数
thread: 1
# 采集间隔时间单位毫秒
interval:
min: 300
max: 500

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +1,511 @@
@charset "utf-8";
.updateTable .style a { color:#999 }
.updateTable .author a { color:#999; cursor:text }
.bind, .updateTable .style a:hover { color:#f65167 }
.userBox { /*width: 998px; border: 1px solid #eaeaea;*/ margin:0 auto 50px; background: #fff; border-radius: 6px }
.channelViewhistory .userBox { margin: 0 auto }
.user_l { width:350px; float:left; padding:50px 50px }
.user_l h3 { font-size:23px; font-weight:normal; line-height:1; text-align: center }
.user_l #LabErr { color:#ff4040; display:block; height:40px; line-height:40px; text-align: center; font-size: 14px }
.user_l .log_list { width:350px }
.user_l .s_input { margin-bottom:25px; font-size:14px }
.s_input { width:348px; height:30px; line-height:38px\9; vertical-align:middle; border:1px solid #ddd; border-radius:2px }
.icon_name, .icon_key, .icon_code { width:312px; padding-left:36px}
.icon_key { background-position: 13px -51px }
.icon_code { background-position: 13px -117px; width:200px; float:left }
.code_pic { height:38px; float:right }
.btn_phone { height:40px; width:100px; float:right; cursor:pointer; padding:0; text-align:center; border-radius:2px; background:#dfdfdf }
.log_code { *padding-bottom:25px }
.user_l .btn_red { width:100%; font-size:19px; padding:12px }
.autologin { color:#999; line-height:1; margin-bottom:18px }
.autologin em { vertical-align:2px; margin-left:4px }
.user_r { width:259px; margin:80px 0; padding:20px 70px; border-left:1px dotted #e3e3e3; float:right; text-align:center }
.user_r .tit { font-size:16px; line-height:1; padding: 6px 0 25px }
.user_r .btn_ora { padding:10px 34px }
.fast_login { padding:60px 0 0 }
.fast_list { text-align:center; padding:0.5rem }
.fast_list li { display:inline-block; *display:inline; zoom:1 }
.fast_list li .img { width:48px; height:48px; margin:20px 0 5px }
.fast_list li a:hover { opacity:0.8; filter: alpha(opacity=80); -moz-opacity: 0.8 }
.fast_list li span { display:block }
.fast_list .login_qq { margin:0 42px }
.fast_list .login_wb a { color:#f55c5b }
.fast_list .login_qq a { color:#51b7ff }
.fast_list .login_wx a { color:#66d65e }
.fast_tit { position:relative; overflow:hidden }
.fast_tit .lines { position:absolute; top:50%; left:0; width:100%; height:1px; line-height:1; background:#eaeaea }
.fast_tit .title { background:#fff; font-size:16px; padding:3px 14px; position:relative; display:inline-block; z-index:999 }
/*userinfo*/
.my_l { width:198px; float:left; font-size: 13px; padding-top: 20px; }
.my_l li a { display:block; height:42px; line-height:42px; padding-left:62px; border-left:4px solid #fff; margin-bottom:5px; color: #666 }
.my_l li .on { background-color:#fafafa; border-left:2px solid #f80; color:#000; border-radius: 0 2px 2px 0 }
.my_l .link_1 { background-position:32px -188px }
.my_l .link_2 { background-position:32px -230px }
.my_l .link_3 { background-position:32px -272px }
.my_l .link_4 { background-position:32px -314px }
.my_l .link_5 { background-position:32px -356px }
.my_l .link_6 { background-position:32px -397px }
.my_l .link_7 { background-position:32px -440px }
.my_l .link_8 { background-position:32px -481px }
.my_r { width:739px; padding:0 30px 30px; float:right; border-left:1px solid #efefef; min-height:470px }
.my_info { padding:30px 0 5px }
.user_big_head { /*width:110px; height:110px; padding:4px; border:1px solid #eaeaea;*/ margin-right:30px; float:left; width: 80px;
height: 80px;
border-radius: 50%; }
.my_r .my_name { font-size:18px; line-height:1; padding:5px 0 12px 0 }
.my_r .s_input { width:318px; padding:0 10px }
.my_list li { line-height:28px }
.my_list li i, .my_list li em.red { margin-right:6px }
.my_list .binded { color:#999; margin-left:6px }
.my_list .btn_link { margin-left:12px }
.mytab_list li { line-height:30px; padding:10px 0; font-size:14px }
.mytab_list li .tit { width:70px; color: #aaa; text-align:right; display:inline-block; margin-right:18px }
.mytab_list .user_img { width:48px; height:48px; vertical-align:middle; border-radius:50% }
.my_bookshelf .title { padding:20px 0 15px; line-height:30px }
.my_bookshelf h4 { font-size:14px; color:#666 }
.my_bookshelf h2 { font-size:18px; font-weight:normal }
.updateTable { width: 739px; color: #999 }
.updateTable table { width: 100%; margin-bottom:14px }
.updateTable th, .updateTable td { height: 40px; line-height: 40px; vertical-align: middle; padding-left: 6px; font-weight:normal; text-align:left }
.updateTable th { background:#f9f9f9; color:#333; border-top:1px solid #eee }
.updateTable td { height:40px; line-height:40px }
.updateTable .style { width:80px; padding-left:10px }
.updateTable .name { width: 178px; padding-right: 10px }
.updateTable .name a, .updateTable .chapter a { max-width: 168px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.updateTable .chapter { padding-right: 5px }
.updateTable .chapter a { max-width:220px; float: left }
.updateTable .author { width: 72px; text-align: left }
.updateTable .goread { width: 80px; text-align:center }
.updateTable .time { width: 86px }
.updateTable .word { width: 64px; padding-right:10px; text-align: right }
.updateTable .rank { width: 30px; padding-right:10px; text-align: center }
.updateTable .name a, .updateTable .chapter a, .updateTable .author a { height: 40px; line-height: 40px; display: inline-block; overflow: hidden }
.updateTable tr:nth-child(2n) td { background:#fafafa }
.dataTable { width: 739px }
.dataTable table { width: 100%; margin-bottom:14px; border-collapse:collapse }
.dataTable th, .dataTable td { height: 40px; line-height: 40px; vertical-align: middle; padding:0 10px; font-weight:normal; text-align:center; border:1px solid #eaeaea }
.dataTable th { background:#f8f8f8 }
.nodate { border-top: 1px solid #eaeaea; padding:60px 0 }
.viewhistoryBox { /*padding: 0 30px 30px; */ padding: 0 20px 10px }
.viewhistoryBox .updateTable { width:100% }
/*.btn_gray, .btn_red, .btn_ora { font-size:14px; padding:8px 28px }*/
.book_tit { height: 48px; line-height:48px; margin: 0 14px; border-bottom: 1px solid #eaeaea; overflow:hidden }
.book_tit .fl { font-size:14px; color:#999 }
.book_tit .fl h3 { font-size:18px; color:#333; font-weight:normal; margin-right:5px; display:inline }
.book_tit .fr { font-size:14px }
.updateTable .style a {
color: #999
}
.updateTable .author a {
color: #999;
cursor: text
}
.bind, .updateTable .style a:hover {
color: #f65167
}
.userBox { /*width: 998px; border: 1px solid #eaeaea;*/
margin: 0 auto 50px;
background: #fff;
border-radius: 6px
}
.channelViewhistory .userBox {
margin: 0 auto
}
.user_l {
width: 350px;
float: left;
padding: 50px 50px
}
.user_l h3 {
font-size: 23px;
font-weight: normal;
line-height: 1;
text-align: center
}
.user_l #LabErr {
color: #ff4040;
display: block;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 14px
}
.user_l .log_list {
width: 350px
}
.user_l .s_input {
margin-bottom: 25px;
font-size: 14px
}
.s_input {
width: 348px;
height: 30px;
line-height: 38px \9;
vertical-align: middle;
border: 1px solid #ddd;
border-radius: 2px
}
.icon_name, .icon_key, .icon_code {
width: 312px;
padding-left: 36px
}
.icon_key {
background-position: 13px -51px
}
.icon_code {
background-position: 13px -117px;
width: 200px;
float: left
}
.code_pic {
height: 38px;
float: right
}
.btn_phone {
height: 40px;
width: 100px;
float: right;
cursor: pointer;
padding: 0;
text-align: center;
border-radius: 2px;
background: #dfdfdf
}
.log_code {
*padding-bottom: 25px
}
.user_l .btn_red {
width: 100%;
font-size: 19px;
padding: 12px
}
.autologin {
color: #999;
line-height: 1;
margin-bottom: 18px
}
.autologin em {
vertical-align: 2px;
margin-left: 4px
}
.user_r {
width: 259px;
margin: 80px 0;
padding: 20px 70px;
border-left: 1px dotted #e3e3e3;
float: right;
text-align: center
}
.user_r .tit {
font-size: 16px;
line-height: 1;
padding: 6px 0 25px
}
.user_r .btn_ora {
padding: 10px 34px
}
.fast_login {
padding: 60px 0 0
}
.fast_list {
text-align: center;
padding: 0.5rem
}
.fast_list li {
display: inline-block;
*display: inline;
zoom: 1
}
.fast_list li .img {
width: 48px;
height: 48px;
margin: 20px 0 5px
}
.fast_list li a:hover {
opacity: 0.8;
filter: alpha(opacity=80);
-moz-opacity: 0.8
}
.fast_list li span {
display: block
}
.fast_list .login_qq {
margin: 0 42px
}
.fast_list .login_wb a {
color: #f55c5b
}
.fast_list .login_qq a {
color: #51b7ff
}
.fast_list .login_wx a {
color: #66d65e
}
.fast_tit {
position: relative;
overflow: hidden
}
.fast_tit .lines {
position: absolute;
top: 50%;
left: 0;
width: 100%;
height: 1px;
line-height: 1;
background: #eaeaea
}
.fast_tit .title {
background: #fff;
font-size: 16px;
padding: 3px 14px;
position: relative;
display: inline-block;
z-index: 999
}
/*userinfo*/
.my_l {
width: 198px;
float: left;
font-size: 13px;
padding-top: 20px;
}
.my_l li a {
display: block;
height: 42px;
line-height: 42px;
padding-left: 62px;
border-left: 4px solid #fff;
margin-bottom: 5px;
color: #666
}
.my_l li .on {
background-color: #fafafa;
border-left: 2px solid #3eaf7c;
color: #000;
border-radius: 0 2px 2px 0
}
.my_l .link_1 {
background-position: 32px -188px
}
.my_l .link_2 {
background-position: 32px -230px
}
.my_l .link_3 {
background-position: 32px -272px
}
.my_l .link_4 {
background-position: 32px -314px
}
.my_l .link_5 {
background-position: 32px -356px
}
.my_l .link_6 {
background-position: 32px -397px
}
.my_l .link_7 {
background-position: 32px -440px
}
.my_l .link_8 {
background-position: 32px -481px
}
.my_r {
width: 739px;
padding: 0 30px 30px;
float: right;
border-left: 1px solid #efefef;
min-height: 470px
}
.my_info {
padding: 30px 0 5px
}
.user_big_head { /*width:110px; height:110px; padding:4px; border:1px solid #eaeaea;*/
margin-right: 30px;
float: left;
width: 80px;
height: 80px;
border-radius: 50%;
}
.my_r .my_name {
font-size: 18px;
line-height: 1;
padding: 5px 0 12px 0
}
.my_r .s_input {
width: 318px;
padding: 0 10px
}
.my_list li {
line-height: 28px
}
.my_list li i, .my_list li em.red {
margin-right: 6px
}
.my_list .binded {
color: #999;
margin-left: 6px
}
.my_list .btn_link {
margin-left: 12px
}
.mytab_list li {
line-height: 30px;
padding: 10px 0;
font-size: 14px
}
.mytab_list li .tit {
width: 70px;
color: #aaa;
text-align: right;
display: inline-block;
margin-right: 18px
}
.mytab_list .user_img {
width: 48px;
height: 48px;
vertical-align: middle;
border-radius: 50%
}
.my_bookshelf .title {
padding: 20px 0 15px;
line-height: 30px
}
.my_bookshelf h4 {
font-size: 14px;
color: #666
}
.my_bookshelf h2 {
font-size: 18px;
font-weight: normal
}
.updateTable {
width: 739px;
color: #999
}
.updateTable table {
width: 100%;
margin-bottom: 14px
}
.updateTable th, .updateTable td {
height: 40px;
line-height: 40px;
vertical-align: middle;
padding-left: 6px;
font-weight: normal;
text-align: left
}
.updateTable th {
background: #f9f9f9;
color: #333;
border-top: 1px solid #eee
}
.updateTable td {
height: 40px;
line-height: 40px
}
.updateTable .style {
width: 80px;
padding-left: 10px
}
.updateTable .name {
width: 178px;
padding-right: 10px
}
.updateTable .name a, .updateTable .chapter a {
max-width: 168px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap
}
.updateTable .chapter {
padding-right: 5px
}
.updateTable .chapter a {
max-width: 220px;
float: left
}
.updateTable .author {
width: 72px;
text-align: left
}
.updateTable .goread {
width: 80px;
text-align: center
}
.updateTable .time {
width: 86px
}
.updateTable .word {
width: 64px;
padding-right: 10px;
text-align: right
}
.updateTable .rank {
width: 30px;
padding-right: 10px;
text-align: center
}
.updateTable .name a, .updateTable .chapter a, .updateTable .author a {
height: 40px;
line-height: 40px;
display: inline-block;
overflow: hidden
}
.updateTable tr:nth-child(2n) td {
background: #fafafa
}
.dataTable {
width: 739px
}
.dataTable table {
width: 100%;
margin-bottom: 14px;
border-collapse: collapse
}
.dataTable th, .dataTable td {
height: 40px;
line-height: 40px;
vertical-align: middle;
padding: 0 10px;
font-weight: normal;
text-align: center;
border: 1px solid #eaeaea
}
.dataTable th {
background: #f8f8f8
}
.nodate {
border-top: 1px solid #eaeaea;
padding: 60px 0
}
.viewhistoryBox { /*padding: 0 30px 30px; */
padding: 0 20px 10px
}
.viewhistoryBox .updateTable {
width: 100%
}
/*.btn_gray, .btn_red, .btn_ora { font-size:14px; padding:8px 28px }*/
.book_tit {
height: 48px;
line-height: 48px;
margin: 0 14px;
border-bottom: 1px solid #eaeaea;
overflow: hidden
}
.book_tit .fl {
font-size: 14px;
color: #999
}
.book_tit .fl h3 {
font-size: 18px;
color: #333;
font-weight: normal;
margin-right: 5px;
display: inline
}
.book_tit .fr {
font-size: 14px
}
.commentBar, .feedback_list {
border-top: 1px solid #eee;
margin-bottom: 15px
}
.commentBar, .feedback_list { border-top:1px solid #eee; margin-bottom:15px }
/*.comment_list { padding: 16px 0; border-bottom: 1px solid #eee }
.comment_list .user_head { width:54px; height:54px; border-radius:50%; float: left; margin-right: 14px }
.comment_list .li_1 { overflow: hidden }
@ -105,33 +516,128 @@
.comment_list .num { color: #ed4259; margin: 0 3px }
.comment_list .li_4 { line-height:34px; padding-top:8px; margin-top:15px; border-top:1px solid #eaeaea }
.comment_list .li_4 .more { background:#f7f7f7; border-radius:2px; color:#ed4259; text-align:center }*/
.no_contet { padding:190px 0 40px; text-align:center; color:#999; border-top:1px solid #eee }
.no_comment { background:url(../images/no_comment.png) no-repeat center 80px }
.no_contet {
padding: 190px 0 40px;
text-align: center;
color: #999;
border-top: 1px solid #eee
}
.no_comment {
background: url(../images/no_comment.png) no-repeat center 80px
}
.comment_list {
padding: 20px 0;
border-bottom: 1px solid #eee
}
.comment_list:last-child {
border: none
}
.comment_list .user_heads { /*width: 54px; height: 54px; float: left;*/
position: relative;
margin-right: 20px
}
.comment_list .user_head {
width: 50px;
height: 50px;
border-radius: 50%;
background: #f6f6f6
}
.comment_list .user_heads span {
display: block;
margin: 0;
position: absolute;
left: 12px;
bottom: 0
}
.comment_list ul { /*width: 640px;*/
width: 660px;
}
.comment_list .li_0 {
font-family: "宋体"
}
.comment_list .li_0 strong {
font-size: 14px;
color: #f00
}
.comment_list .li_1 {
overflow: hidden
}
.comment_list .user_name {
color: #ed4259
}
.comment_list .li_2 {
padding: 6px 0
}
.comment_list .li_3 {
color: #999
}
.comment_list .reply {
padding-left: 12px
}
.comment_list .num {
color: #ed4259;
margin: 0 3px
}
.comment_list .li_4 {
line-height: 34px;
padding-top: 8px;
margin-top: 15px;
border-top: 1px solid #eaeaea
}
.pl_bar li {
display: block
}
.pl_bar .name {
color: #666;
padding-top: 2px;
font-size: 14px
}
.pl_bar .dec {
font-size: 14px;
line-height: 1.8;
padding: 12px 0
}
.pl_bar .other {
line-height: 24px;
color: #999;
font-size: 13px
}
.pl_bar .other a {
display: inline-block;
color: #999
}
.pl_bar .reply {
padding-left: 22px;
background: url(../images/icon_reply.png) no-repeat 0 2px
}
.comment_list { padding: 20px 0; border-bottom: 1px solid #eee }
.comment_list:last-child { border: none }
.comment_list .user_heads { /*width: 54px; height: 54px; float: left;*/ position:relative; margin-right: 20px }
.comment_list .user_head { width: 50px; height: 50px; border-radius: 50%; background: #f6f6f6 }
.comment_list .user_heads span { display: block; margin: 0; position: absolute; left: 12px; bottom: 0 }
.comment_list ul { /*width: 640px;*/ width: 660px; }
.comment_list .li_0 { font-family: "宋体" }
.comment_list .li_0 strong { font-size: 14px; color: #f00 }
.comment_list .li_1 { overflow: hidden }
.comment_list .user_name { color: #ed4259 }
.comment_list .li_2 { padding: 6px 0 }
.comment_list .li_3 { color: #999 }
.comment_list .reply { padding-left: 12px }
.comment_list .num { color: #ed4259; margin: 0 3px }
.comment_list .li_4 { line-height: 34px; padding-top: 8px; margin-top: 15px; border-top: 1px solid #eaeaea }
.pl_bar li { display: block }
.pl_bar .name { color: #666; padding-top: 2px; font-size: 14px }
.pl_bar .dec { font-size: 14px; line-height: 1.8; padding: 12px 0 }
.pl_bar .other { line-height: 24px; color: #999; font-size: 13px }
.pl_bar .other a { display: inline-block; color: #999 }
.pl_bar .reply { padding-left: 22px; background: url(../images/icon_reply.png) no-repeat 0 2px }
/*.no_comment { padding: 70px 14px 115px; color: #CCCCCC; text-align: center; font-size: 14px; }*/
.reply_bar {
background: #f9f9f9;
border: 1px solid #eee; border-radius: 6px;
border: 1px solid #eee;
border-radius: 6px;
padding: 10px;
line-height: 1.8;}
line-height: 1.8;
}

View File

@ -457,8 +457,8 @@ html #layuicss-layer {
}
.layui-layer-btn .layui-layer-btn0 {
border-color: #f70;
background-color: #f70;
border-color: #3eaf7c;
background-color: #3eaf7c;
color: #fff
}

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1" href="/">爬虫源管理</a></li>
<li><a class="link_1 on" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -47,7 +39,7 @@
<h3>采集信息填写示例均为笔趣阁http://www.mcmssc.com</h3>
<ul class="log_list">
<li><span id="LabErr"></span></li>
<input type="hidden" id="sourceName" class="s_input icon_name" >
<input type="hidden" id="sourceName" class="s_input icon_name">
<b>采集源:</b>
<li><select id="sourceId" class="s_input icon_key">
</select></li>
@ -99,16 +91,16 @@
$.ajax({
type: "get",
url: "/crawl/listCrawlByPage",
data: {'curr':1,'limit':100},
data: {'curr': 1, 'limit': 100},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var crawlSourceList = data.data.list;
if (crawlSourceList.length > 0) {
var crawlSourceListHtml = "";
for(var i=0;i<crawlSourceList.length;i++){
for (var i = 0; i < crawlSourceList.length; i++) {
var crawlSource = crawlSourceList[i];
crawlSourceListHtml+=("<option value=\""+crawlSource.id+"\">"+crawlSource.sourceName+"</option>");
crawlSourceListHtml += ("<option value=\"" + crawlSource.id + "\">" + crawlSource.sourceName + "</option>");
}
$("#sourceId").html(crawlSourceListHtml);
@ -120,7 +112,7 @@
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}
@ -143,21 +135,21 @@
var sourceBookId = $("#sourceBookId").val();
if (!sourceBookId){
if (!sourceBookId) {
layer.alert("采集的源站小说ID不能为空");
return;
}
var bookName = $("#bookName").val();
if (!bookName){
if (!bookName) {
layer.alert("采集的小说名不能为空");
return;
}
var authorName = $("#authorName").val();
if (!authorName){
if (!authorName) {
layer.alert("采集的小说作者名不能为空");
return;
}
@ -165,7 +157,14 @@
$.ajax({
type: "POST",
url: "/crawl/addCrawlSingleTask",
data: {'sourceId': sourceId, 'sourceName': sourceName,'catId':catId,'sourceBookId' : sourceBookId,'bookName':bookName,'authorName':authorName},
data: {
'sourceId': sourceId,
'sourceName': sourceName,
'catId': catId,
'sourceBookId': sourceBookId,
'bookName': bookName,
'authorName': authorName
},
dataType: "json",
success: function (data) {
if (data.code == 200) {

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1" href="/">爬虫源管理</a></li>
<li><a class="link_1 on" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -151,7 +143,7 @@
" " + crawlSource.excCount + "\n" +
" </td>\n" +
" <td class=\"goread\">\n" +
" " + (crawlSource.taskStatus == 0 ? '采集失败' : (crawlSource.taskStatus == 1 ? '采集成功' : (crawlSource.excCount>0?'采集中':'排队中'))) + "\n" +
" " + (crawlSource.taskStatus == 0 ? '采集失败' : (crawlSource.taskStatus == 1 ? '采集成功' : (crawlSource.excCount > 0 ? '采集中' : '排队中'))) + "\n" +
" </td>\n" +
" <td class=\"name\" valsc=\"291|2037554|1\">"
+ crawlSource.createTime + "</td>\n" +
@ -190,7 +182,7 @@
}
} else {
} else {
layer.alert(data.msg);
}
@ -207,7 +199,7 @@
$.ajax({
type: "delete",
url: "/crawl/delCrawlSingleTask/"+id,
url: "/crawl/delCrawlSingleTask/" + id,
data: {},
dataType: "json",
success: function (data) {

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1 on" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -152,6 +144,9 @@
示例:<b>&lt;script&gt;</b>
<li><input type="text" id="contentEnd" class="s_input icon_key"
placeholder="小说内容结束截取字符串"></li>
示例:<b>&lt;div\s+id=&quot;content_tip&quot;&gt;\s*&lt;b&gt;([^/]+)&lt;/b&gt;\s*&lt;/div&gt;</b>
<li><textarea id="filterContent"
placeholder="过滤内容多个内容换行" rows="5" cols="52"></textarea></li>
<li><input type="button" onclick="addCrawlSource()" name="btnRegister" value="提交"
id="btnRegister" class="btn_red"></li>
@ -413,6 +408,9 @@
crawlRule.contentEnd = contentEnd;
var filterContent = $("#filterContent").val();
crawlRule.filterContent = filterContent;
$.ajax({
type: "POST",

View File

@ -1,5 +1,5 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<head>
@ -7,19 +7,12 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>爬虫管理系统-小说精品屋</title>
<link rel="stylesheet" href="/css/base.css?v=1"/>
<link rel="stylesheet" href="/css/user.css" />
<link rel="stylesheet" href="/css/user.css"/>
</head>
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf" style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -29,9 +22,9 @@
<ul class="log_list">
<li><a class="link_1 on" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!-- <li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
</div>
@ -40,6 +33,7 @@
<div class="title cf">
<h2 class="fl">爬虫源列表</h2>
<div class="fr"><a href="/crawl/crawlSource_add.html" class="btn_red">增加爬虫源</a>
</div>
</div>
<div id="divData" class="updateTable">
@ -69,7 +63,6 @@
<tbody id="crawlSourceList">
</tbody>
</table>
<div class="pageBox cf" id="shellPage">
@ -120,38 +113,39 @@
<script language="javascript" type="text/javascript">
search(1, 10);
var pageCrawlSourceList=null;
var pageCrawlSourceList = null;
function search(curr, limit) {
$.ajax({
type: "get",
url: "/crawl/listCrawlByPage",
data: {'curr':curr,'limit':limit},
data: {'curr': curr, 'limit': limit},
dataType: "json",
success: function (data) {
if (data.code == 200) {
var crawlSourceList = data.data.list;
pageCrawlSourceList=data.data.list;
pageCrawlSourceList = data.data.list;
if (crawlSourceList.length > 0) {
var crawlSourceListHtml = "";
for(var i=0;i<crawlSourceList.length;i++){
for (var i = 0; i < crawlSourceList.length; i++) {
var crawlSource = crawlSourceList[i];
crawlSourceListHtml+=(" <tr class=\"book_list\" vals=\"291\">\n" +
crawlSourceListHtml += (" <tr class=\"book_list\" vals=\"291\">\n" +
" <td class=\"style bookclass\">\n" +
" ["+(i+1)+"]\n" +
" [" + (i + 1) + "]\n" +
" </td>\n" +
" <td class=\"chapter\">\n" +
" "+crawlSource.sourceName+"</td>\n" +
" " + crawlSource.sourceName + "</td>\n" +
" <td class=\"name\" valsc=\"291|2037554|1\">"
+crawlSource.createTime+"</td>\n" +
+ crawlSource.createTime + "</td>\n" +
" <td class=\"name\">\n" +
" "+crawlSource.updateTime+"\n" +
" " + crawlSource.updateTime + "\n" +
" </td>\n" +
" <td class=\"goread\" id='sourceStatus"+crawlSource.id+"'>"+(crawlSource.sourceStatus==0?'停止运行':'正在运行')+
" <td class=\"goread\" id='sourceStatus" + crawlSource.id + "'>" + (crawlSource.sourceStatus == 0 ? '停止运行' : '正在运行') +
" </td>\n" +
" <td class=\"goread\" id='opt"+crawlSource.id+"'><a href='javascript:openOrStopCrawl("+crawlSource.id+","+crawlSource.sourceStatus+")'>"+(crawlSource.sourceStatus==0?'开启':'关闭')+" </a>" +
"<a href='javascript:updateCrawlSource("+crawlSource.id+")'>修改 </a>" +
" <td class=\"goread\" id='opt" + crawlSource.id + "'><a href='javascript:openOrStopCrawl(" + crawlSource.id + "," + crawlSource.sourceStatus + ")'>" + (crawlSource.sourceStatus == 0 ? '开启' : '关闭') + " </a>" +
"<a href='javascript:updateCrawlSource(" + crawlSource.id + ")'>修改 </a>" +
"</td> </tr>");
}
$("#crawlSourceList").html(crawlSourceListHtml);
@ -190,7 +184,7 @@
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}
@ -201,31 +195,32 @@
})
}
function updateCrawlSource(crawlSourceId){
localStorage.setItem("crawlSourceId",crawlSourceId);
window.location.href="/crawl/crawlSource_update.html";
function updateCrawlSource(crawlSourceId) {
localStorage.setItem("crawlSourceId", crawlSourceId);
window.location.href = "/crawl/crawlSource_update.html";
}
function openOrStopCrawl(sourceId,status) {
function openOrStopCrawl(sourceId, status) {
$.ajax({
type: "POST",
url: "/crawl/openOrCloseCrawl",
data: {'sourceId':sourceId,'sourceStatus':status==0?1:0},
data: {'sourceId': sourceId, 'sourceStatus': status == 0 ? 1 : 0},
dataType: "json",
success: function (data) {
if (data.code == 200) {
if(status == 0){
if (status == 0) {
//开启
$("#sourceStatus"+sourceId).html("正在运行");
$("#opt"+sourceId).html("<a href='javascript:openOrStopCrawl("+sourceId+","+1+")'>关闭</a>");
}else{
$("#sourceStatus" + sourceId).html("正在运行");
$("#opt" + sourceId).html("<a href='javascript:openOrStopCrawl(" + sourceId + "," + 1 + ")'>关闭</a>");
} else {
//关闭
$("#sourceStatus"+sourceId).html("停止运行");
$("#opt"+sourceId).html("<a href='javascript:openOrStopCrawl("+sourceId+","+0+")'>开启</a>");
$("#sourceStatus" + sourceId).html("停止运行");
$("#opt" + sourceId).html("<a href='javascript:openOrStopCrawl(" + sourceId + "," + 0 + ")'>开启</a>");
}
@ -233,7 +228,7 @@
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}
@ -244,9 +239,6 @@
})
}
</script>
</html>

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -28,9 +20,9 @@
<div class="my_l">
<ul class="log_list">
<li><a class="link_1 on" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1 on" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -64,12 +56,12 @@
示例:<b>value=\"(\\d+)/\\d+\"</b>
<li><input type="text" id="rule" class="s_input icon_name" placeholder="规则"></li>
示例:<b>1强制刷新 空或0使用缓存</b>
<li><input type="text" id="isRefresh" class="s_input icon_name" placeholder="是否强制刷新"></li>
<li><input type="text" id="isRefresh" class="s_input icon_name" placeholder="是否强制刷新">
</li>
<li><textarea rows="20" cols="100" id="resultMap"></textarea></li>
<li><input type="button" onclick="testCrawlSource()" name="btnRegister" value="测试"
id="btnRegister" class="btn_red"></li>
</ul>
@ -120,11 +112,12 @@
<script src="/javascript/user.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function load() {
var testParseUrl= localStorage.getItem("testParseUrl");
$("#url").val(testParseUrl);
var testParseRule=localStorage.getItem("testParseRule");
var testParseUrl = localStorage.getItem("testParseUrl");
$("#url").val(testParseUrl);
var testParseRule = localStorage.getItem("testParseRule");
$("#rule").val(testParseRule);
}
function testCrawlSource() {
var data = {};
@ -145,8 +138,8 @@
}
data.url = url;
localStorage.setItem("testParseUrl",url);
localStorage.setItem("testParseRule",rule);
localStorage.setItem("testParseUrl", url);
localStorage.setItem("testParseRule", rule);
$.ajax({
type: "POST",
url: "/crawl/testParse",

View File

@ -12,15 +12,7 @@
</head>
<body class="">
<div class="header">
<div class="mainNav" id="mainNav">
<div class="box_center cf"
style="text-align: center;height: 44px;line-height: 48px;color: #fff;font-size: 16px;">
小说精品屋爬虫管理
</div>
</div>
<div th:replace="crawl/header :: header">
</div>
<div class="main box_center cf">
@ -30,7 +22,7 @@
<ul class="log_list">
<li><a class="link_1 on" href="/">爬虫源管理</a></li>
<li><a class="link_1" href="/crawl/crawlSingleTask_list.html">单本采集管理</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank" >规则测试</a></li>
<li><a class="link_1" href="/crawl/crawlSource_test.html" target="_blank">规则测试</a></li>
<!--<li><a class="link_1 " href="/user/userinfo.html">批量小说爬取</a></li>
<li><a class="link_4 " href="/user/favorites.html">单本小说爬取</a></li>-->
</ul>
@ -153,6 +145,10 @@
示例:<b>&lt;script&gt;</b>
<li><input type="text" id="contentEnd" class="s_input icon_key"
placeholder="小说内容结束截取字符串"></li>
示例:<b>&lt;div\s+id=&quot;content_tip&quot;&gt;\s*&lt;b&gt;([^/]+)&lt;/b&gt;\s*&lt;/div&gt;</b>
<li><textarea id="filterContent"
placeholder="过滤内容多个内容换行" rows="5" cols="52"></textarea></li>
<li><input type="button" onclick="updateCrawlSource()" name="btnRegister" value="提交"
id="btnRegister" class="btn_red"></li>
@ -204,12 +200,12 @@
<script src="/javascript/user.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
function load(){
function load() {
var crawlSourceId = localStorage.getItem("crawlSourceId")
if(crawlSourceId!=null){
if (crawlSourceId != null) {
$.ajax({
type: "GET",
url: "/crawl/getCrawlSource/"+crawlSourceId,
url: "/crawl/getCrawlSource/" + crawlSourceId,
dataType: "json",
success: function (data) {
if (data.code == 200) {
@ -218,7 +214,7 @@
//未登录
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
}else {
} else {
layer.alert(data.msg);
}
@ -229,20 +225,21 @@
})
}
}
function loadPage(data){
function loadPage(data) {
$("#sourceId").val(data.id);
$("#sourceName").val(data.sourceName);
if(data.crawlRule){
if (data.crawlRule) {
var crawlRule= JSON.parse(data.crawlRule);
var crawlRule = JSON.parse(data.crawlRule);
$("#bookListUrl").val(crawlRule.bookListUrl);
var catIdRule = crawlRule.catIdRule;
try{
try {
for (var i = 1; i <= 7; i++) {
$("#catId" + i).val(catIdRule["catId" + i]);
}
}catch(e){
} catch (e) {
}
$("#bookIdPatten").val(crawlRule.bookIdPatten);
$("#pagePatten").val(crawlRule.pagePatten);
@ -253,14 +250,14 @@
$("#picUrlPatten").val(crawlRule.picUrlPatten);
$("#picUrlPrefix").val(crawlRule.picUrlPrefix);
$("#statusPatten").val(crawlRule.statusPatten);
try{
try {
var bookStatusRule = crawlRule.bookStatusRule;
var i=0;
for(var key in bookStatusRule){
var i = 0;
for (var key in bookStatusRule) {
$("#bookStatus" + i).val(key);
i++;
}
}catch (e) {
} catch (e) {
}
$("#scorePatten").val(crawlRule.scorePatten);
@ -276,15 +273,17 @@
$("#bookContentUrl").val(crawlRule.bookContentUrl);
$("#contentStart").val(crawlRule.contentStart);
$("#contentEnd").val(crawlRule.contentEnd);
$("#filterContent").val(crawlRule.filterContent);
}
}
load();
function updateCrawlSource() {
var crawlRule = {};
var sourceId =$("#sourceId").val();
var sourceId = $("#sourceId").val();
var sourceName = $("#sourceName").val();
if (sourceName.length == 0) {
@ -494,11 +493,14 @@
crawlRule.contentEnd = contentEnd;
var filterContent = $("#filterContent").val();
crawlRule.filterContent = filterContent;
$.ajax({
type: "POST",
url: "/crawl/updateCrawlSource",
data: {'id':sourceId,'sourceName': sourceName, 'crawlRule': JSON.stringify(crawlRule)},
data: {'id': sourceId, 'sourceName': sourceName, 'crawlRule': JSON.stringify(crawlRule)},
dataType: "json",
success: function (data) {
if (data.code == 200) {

Some files were not shown because too many files have changed in this diff Show More