From d4e1126873bb5efacf3bb73a2d8927285ca2b439 Mon Sep 17 00:00:00 2001
From: xiongxiaoyang <1179705413@qq.com>
Date: Tue, 22 Jul 2025 11:55:27 +0800
Subject: [PATCH 01/12] =?UTF-8?q?perf:=20UI=E4=BC=98=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../templates/mobile/book/book_ranking.html | 25 ++--
.../templates/mobile/common/css.html | 9 ++
.../resources/templates/mobile/index.html | 127 +++++++++++-------
3 files changed, 105 insertions(+), 56 deletions(-)
diff --git a/novel-front/src/main/resources/templates/mobile/book/book_ranking.html b/novel-front/src/main/resources/templates/mobile/book/book_ranking.html
index f43f4ab..18de2e8 100644
--- a/novel-front/src/main/resources/templates/mobile/book/book_ranking.html
+++ b/novel-front/src/main/resources/templates/mobile/book/book_ranking.html
@@ -1,6 +1,4 @@
-
-
@@ -16,8 +14,6 @@
-
-
@@ -187,19 +192,19 @@
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
}
- bookListHtml += ("\n" +
+ bookListHtml += ("
\n" +
"
\n" +
- " \n" +
- "
![]()
\n" +
+ "

\n" +
"\n" +
"
\n" +
" \n" +
- "
\n" +
+ "
\n" +
"
\n" +
" " + book.bookName + "
\n" +
" \n" +
- "
\n" +
+ "
\n" +
"
\n" +
" 作者:" + book.authorName + "
\n" +
" \n" +
@@ -207,7 +212,7 @@
"
状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "
\n" +
"
更新:" + book.lastIndexUpdateTime.substr(0, 11) + "\n" +
"
\n" +
- "
简介:" + (book.bookDesc ? (book.bookDesc.length > 15 ? (book.bookDesc.substr(0, 15) + "...") : book.bookDesc) : book.bookDesc) + "
\n" +
+ "
简介:" + (book.bookDesc) + "
\n" +
"\n" +
"\n" +
"
\n" +
diff --git a/novel-front/src/main/resources/templates/mobile/common/css.html b/novel-front/src/main/resources/templates/mobile/common/css.html
index e40c070..a6da973 100644
--- a/novel-front/src/main/resources/templates/mobile/common/css.html
+++ b/novel-front/src/main/resources/templates/mobile/common/css.html
@@ -26,6 +26,15 @@
}
}
+ .book_name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ white-space: pre-wrap;
+ }
+
#footer {
position: absolute;
bottom: 0px;
diff --git a/novel-front/src/main/resources/templates/mobile/index.html b/novel-front/src/main/resources/templates/mobile/index.html
index 0cc9db3..799ca61 100644
--- a/novel-front/src/main/resources/templates/mobile/index.html
+++ b/novel-front/src/main/resources/templates/mobile/index.html
@@ -53,6 +53,44 @@
color: #3eaf7c;
}
+ .container {
+ display: flex;
+ overflow-x: auto; /* 允许内容水平滚动 */
+ white-space: nowrap; /* 禁止换行 */
+ scroll-snap-type: x mandatory; /* 在滚动时强制对齐 snap-points */
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
+ scrollbar-width: none; /* Firefox */
+ }
+
+ .container::-webkit-scrollbar {
+ width: 0;
+ height: 0;
+ }
+
+ .container::-webkit-scrollbar-track,
+ .container::-webkit-scrollbar-thumb {
+ display: none;
+ }
+
+
+ .item {
+ flex: 0 0 calc(100% / 10); /* 每个元素宽度为容器的十分之一 */
+ scroll-snap-align: start;
+ box-sizing: border-box;
+ text-align: center;
+ border-radius: 5px;
+ margin-right: 5px;
+ }
+
+ .book_desc {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ white-space: pre-wrap;
+ }
+
@@ -107,60 +145,58 @@
精品推荐
+
+
+
@@ -184,7 +220,6 @@
-
@@ -226,7 +261,7 @@
"\n" +
"
\n" +
"
简介: " + updateRankBook.bookDesc + "" +
+ " class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介:" + updateRankBook.bookDesc + "" +
"
\n" +
"
");
From d4e8fb1cc758ffe25e1283fd320715f42da57bf5 Mon Sep 17 00:00:00 2001
From: xiongxiaoyang <1179705413@qq.com>
Date: Fri, 25 Jul 2025 12:58:18 +0800
Subject: [PATCH 02/12] =?UTF-8?q?=E6=A8=A1=E7=89=88=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../green/html/book/book_comment_reply.html | 216 ++++++++++++++++++
.../green/html/mobile/book/book_ranking.html | 25 +-
templates/green/html/mobile/common/css.html | 9 +
templates/green/html/mobile/index.html | 127 ++++++----
.../green/static/javascript/bookdetail.js | 46 ++++
5 files changed, 367 insertions(+), 56 deletions(-)
create mode 100644 templates/green/html/book/book_comment_reply.html
diff --git a/templates/green/html/book/book_comment_reply.html b/templates/green/html/book/book_comment_reply.html
new file mode 100644
index 0000000..0774fe5
--- /dev/null
+++ b/templates/green/html/book/book_comment_reply.html
@@ -0,0 +1,216 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/green/html/mobile/book/book_ranking.html b/templates/green/html/mobile/book/book_ranking.html
index f43f4ab..18de2e8 100644
--- a/templates/green/html/mobile/book/book_ranking.html
+++ b/templates/green/html/mobile/book/book_ranking.html
@@ -1,6 +1,4 @@
-
-
@@ -16,8 +14,6 @@
-
-
@@ -187,19 +192,19 @@
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
}
- bookListHtml += ("\n" +
+ bookListHtml += ("
\n" +
"
\n" +
- " \n" +
- "
![]()
\n" +
+ "

\n" +
"\n" +
"
\n" +
" \n" +
- "
\n" +
+ "
\n" +
"
\n" +
" " + book.bookName + "
\n" +
" \n" +
- "
\n" +
+ "
\n" +
"
\n" +
" 作者:" + book.authorName + "
\n" +
" \n" +
@@ -207,7 +212,7 @@
"
状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "
\n" +
"
更新:" + book.lastIndexUpdateTime.substr(0, 11) + "\n" +
"
\n" +
- "
简介:" + (book.bookDesc ? (book.bookDesc.length > 15 ? (book.bookDesc.substr(0, 15) + "...") : book.bookDesc) : book.bookDesc) + "
\n" +
+ "
简介:" + (book.bookDesc) + "
\n" +
"\n" +
"\n" +
"
\n" +
diff --git a/templates/green/html/mobile/common/css.html b/templates/green/html/mobile/common/css.html
index e40c070..a6da973 100644
--- a/templates/green/html/mobile/common/css.html
+++ b/templates/green/html/mobile/common/css.html
@@ -26,6 +26,15 @@
}
}
+ .book_name {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ white-space: pre-wrap;
+ }
+
#footer {
position: absolute;
bottom: 0px;
diff --git a/templates/green/html/mobile/index.html b/templates/green/html/mobile/index.html
index 0cc9db3..799ca61 100644
--- a/templates/green/html/mobile/index.html
+++ b/templates/green/html/mobile/index.html
@@ -53,6 +53,44 @@
color: #3eaf7c;
}
+ .container {
+ display: flex;
+ overflow-x: auto; /* 允许内容水平滚动 */
+ white-space: nowrap; /* 禁止换行 */
+ scroll-snap-type: x mandatory; /* 在滚动时强制对齐 snap-points */
+ -ms-overflow-style: none; /* Internet Explorer 10+ */
+ scrollbar-width: none; /* Firefox */
+ }
+
+ .container::-webkit-scrollbar {
+ width: 0;
+ height: 0;
+ }
+
+ .container::-webkit-scrollbar-track,
+ .container::-webkit-scrollbar-thumb {
+ display: none;
+ }
+
+
+ .item {
+ flex: 0 0 calc(100% / 10); /* 每个元素宽度为容器的十分之一 */
+ scroll-snap-align: start;
+ box-sizing: border-box;
+ text-align: center;
+ border-radius: 5px;
+ margin-right: 5px;
+ }
+
+ .book_desc {
+ overflow: hidden;
+ text-overflow: ellipsis;
+ display: -webkit-box;
+ -webkit-line-clamp: 3;
+ -webkit-box-orient: vertical;
+ white-space: pre-wrap;
+ }
+
@@ -107,60 +145,58 @@
精品推荐
+
+
+
@@ -184,7 +220,6 @@
-
@@ -226,7 +261,7 @@
"\n" +
"
\n" +
"
简介: " + updateRankBook.bookDesc + "" +
+ " class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介:" + updateRankBook.bookDesc + "" +
"
\n" +
"
");
diff --git a/templates/green/static/javascript/bookdetail.js b/templates/green/static/javascript/bookdetail.js
index 3f6acd3..7760961 100644
--- a/templates/green/static/javascript/bookdetail.js
+++ b/templates/green/static/javascript/bookdetail.js
@@ -133,6 +133,52 @@
})
+ },
+
+ SaveCommentReply: function (cmtBId, cmtCId, cmtDetail) {
+ if (!isLogin) {
+ layer.alert('请先登录');
+ return;
+ }
+ var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
+ if (cmtDetailTemp == '') {
+ layer.alert('回复内容必须填写');
+ return;
+ }
+ if (cmtDetailTemp.length < 5) {
+ layer.alert('回复内容必须大于5个字');
+ return;
+ }
+ if (cmtDetail.length < 5) {
+ layer.alert('回复内容必须大于5个字');
+ return;
+ }
+ $.ajax({
+ type: "POST",
+ url: "/book/addCommentReply",
+ data: {'commentId': $("#commentId").val(), 'replyContent': cmtDetail},
+ dataType: "json",
+ success: function (data) {
+ if (data.code == 200) {
+ $('#txtComment').val("")
+ layer.alert('回复成功!');
+ loadCommentList(1, 20);
+
+ } else if (data.code == 1001) {
+ //未登录
+ location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
+
+ } else {
+ layer.alert(data.msg);
+ }
+
+ },
+ error: function () {
+ layer.alert('网络异常');
+ }
+ })
+
+
},
GetFavoritesBook: function (BId) {
},
From 7e27456a65cfb04fcb0e6bde712a020e3daaae04 Mon Sep 17 00:00:00 2001
From: xiongxiaoyang <1179705413@qq.com>
Date: Fri, 25 Jul 2025 13:00:00 +0800
Subject: [PATCH 03/12] =?UTF-8?q?build=EF=BC=9A=E6=89=93=E5=8C=85=E6=97=B6?=
=?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=9C=80=E6=96=B0=E6=A8=A1=E7=89=88=E6=96=87?=
=?UTF-8?q?=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
novel-front/pom.xml | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/novel-front/pom.xml b/novel-front/pom.xml
index 92e860f..79913a5 100644
--- a/novel-front/pom.xml
+++ b/novel-front/pom.xml
@@ -96,6 +96,16 @@
+
+
+
+
+
+
+
+
+
+
From c24c68ecaf3e1827ee6d895c5812665d6da7f063 Mon Sep 17 00:00:00 2001
From: xiongxiaoyang <1179705413@qq.com>
Date: Fri, 25 Jul 2025 17:03:46 +0800
Subject: [PATCH 04/12] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E7=BC=93?=
=?UTF-8?q?=E5=AD=98=E6=A8=A1=E5=9D=97?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
提升可读性 & 减小内存占用
---
.../controller/FriendLinkController.java | 4 +-
.../novel/controller/NewsController.java | 4 +-
.../java2nb/novel/core/cache/CacheKey.java | 2 +-
.../novel/core/cache/CacheService.java | 86 ++++++++++---------
.../core/cache/impl/RedisServiceImpl.java | 62 +++++++++++--
.../novel/controller/CrawlController.java | 8 +-
.../java2nb/novel/core/crawl/CrawlParser.java | 1 -
.../novel/controller/BookController.java | 2 +-
.../novel/controller/page/PageController.java | 2 +-
.../java2nb/novel/service/BookService.java | 5 +-
.../novel/service/impl/BookServiceImpl.java | 34 ++++----
.../service/impl/FriendLinkServiceImpl.java | 21 +++--
.../novel/service/impl/LikeServiceImpl.java | 32 +++----
.../novel/service/impl/NewsServiceImpl.java | 40 ++++-----
14 files changed, 173 insertions(+), 130 deletions(-)
diff --git a/novel-admin/src/main/java/com/java2nb/novel/controller/FriendLinkController.java b/novel-admin/src/main/java/com/java2nb/novel/controller/FriendLinkController.java
index dd86893..0847fc4 100644
--- a/novel-admin/src/main/java/com/java2nb/novel/controller/FriendLinkController.java
+++ b/novel-admin/src/main/java/com/java2nb/novel/controller/FriendLinkController.java
@@ -9,7 +9,7 @@ import com.java2nb.novel.service.FriendLinkService;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.validation.annotation.Validated;
@@ -31,7 +31,7 @@ public class FriendLinkController {
@Autowired
private FriendLinkService friendLinkService;
@Autowired
- private RedisTemplate