Compare commits
37 Commits
v5.0.0
...
develop_xx
Author | SHA1 | Date | |
---|---|---|---|
|
df1b72fb58 | ||
|
415bf8a64c | ||
|
3f009dc1f9 | ||
|
0e156c04b4 | ||
|
d4fa0abc4e | ||
|
eff4fc4c7c | ||
|
8c1c0f10be | ||
|
02ad0f93dc | ||
|
a06132a4c2 | ||
|
f043ddff42 | ||
|
328bd55587 | ||
|
04fc8e878a | ||
|
970ad407f1 | ||
|
f8079f443a | ||
|
75a4c3002b | ||
|
e4e511aed8 | ||
|
ec9674f2aa | ||
|
06074faf9a | ||
|
73654dda2b | ||
|
c0634a335e | ||
|
5dcc2b0b46 | ||
|
6cdb68899b | ||
|
d955b11165 | ||
|
99f2a15990 | ||
|
1081b8e10a | ||
|
4b1507b2d1 | ||
|
82658f3b5f | ||
|
acf9c76757 | ||
|
4b00ea68a9 | ||
|
d9f9fd8bd2 | ||
|
c1583f83bb | ||
|
eecbb2dd9c | ||
|
0afc7b1bbf | ||
|
f5a9a7423f | ||
|
3858cd4e49 | ||
|
c4a6acf2b3 | ||
|
8781cc54d4 |
79
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,79 @@
|
||||
name: Create novel-plus Maven Release with ZIPs
|
||||
|
||||
on:
|
||||
push:
|
||||
# 匹配所有以'v'开头的标签
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-and-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Set up JDK 21
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: '21'
|
||||
# 可选,默认是 temurin,也可以选择其他发行版
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Build project with Maven
|
||||
run: mvn clean install -DskipTests=true -Pcentral-repo
|
||||
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
# 使用 tag_name 而不是 github.ref
|
||||
tag_name: ${{ github.ref_name }}
|
||||
release_name: novel-plus ${{ github.ref_name }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
|
||||
|
||||
# 使用 action 来替代直接 curl 进行上传
|
||||
- name: Upload sql.zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ github.workspace }}/novel-common/target/build/sql.zip
|
||||
asset_name: sql.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload novel-crawl.zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ github.workspace }}/novel-crawl/target/build/novel-crawl.zip
|
||||
asset_name: novel-crawl.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload novel-front.zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ github.workspace }}/novel-front/target/build/novel-front.zip
|
||||
asset_name: novel-front.zip
|
||||
asset_content_type: application/zip
|
||||
|
||||
- name: Upload novel-admin.zip
|
||||
uses: actions/upload-release-asset@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ github.workspace }}/novel-admin/target/build/novel-admin.zip
|
||||
asset_name: novel-admin.zip
|
||||
asset_content_type: application/zip
|
77
README.md
@ -17,7 +17,7 @@
|
||||
|
||||
novel-plus 是一个多端(PC、WAP)阅读,功能完善的原创文学 CMS
|
||||
系统。由前台门户系统、作家后台管理系统、平台后台管理系统和爬虫管理系统等多个子系统构成,包括小说推荐、作品检索、小说排行、小说阅读、小说评论、会员中心、作家专区等功能,支持自定义多模版、可拓展的多种小说内容存储方式(内置数据库分表存储和
|
||||
TXT 文本存储)、阅读主题切换、多爬虫源自动采集和更新数据、会员充值、订阅模式、新闻发布和实时统计报表。
|
||||
TXT 文本存储)、阅读主题切换、多爬虫源自动采集和更新数据、AI写作、会员充值、订阅模式、新闻发布和实时统计报表。
|
||||
|
||||
## 项目地址
|
||||
|
||||
@ -39,24 +39,25 @@ novel-plus -- 父工程
|
||||
|
||||
## 技术选型
|
||||
|
||||
| 技术 | 说明
|
||||
|---------------------| ---------------------------
|
||||
| Spring Boot | Spring 应用快速开发脚手架
|
||||
| MyBatis | 持久层 ORM 框架
|
||||
| MyBatis Dynamic SQL | Mybatis 动态 sql
|
||||
| PageHelper | MyBatis 分页插件
|
||||
| MyBatis Generator | 持久层代码生成插件
|
||||
| Sharding-JDBC | 代码层分库分表中间件
|
||||
| JJWT | JWT 登录支持
|
||||
| Spring Security | 安全框架
|
||||
| Apache Shiro | 安全框架
|
||||
| Redis | 缓存方案
|
||||
| Aliyun OSS | 阿里云对象存储服务(图片存储备选方案)
|
||||
| Lombok | 简化对象封装工具
|
||||
| Docker | 应用容器引擎
|
||||
| MySQL | 数据库服务
|
||||
| Thymeleaf | 模板引擎
|
||||
| Layui | 前端 UI 框架
|
||||
| 技术 | 说明
|
||||
|---------------------|---------------------
|
||||
| Spring Boot | Spring 应用快速开发脚手架
|
||||
| Spring AI | Spring 官方 AI 框架
|
||||
| MyBatis | 持久层 ORM 框架
|
||||
| MyBatis Dynamic SQL | Mybatis 动态 sql
|
||||
| PageHelper | MyBatis 分页插件
|
||||
| MyBatis Generator | 持久层代码生成插件
|
||||
| Sharding-JDBC | 代码层分库分表中间件
|
||||
| JJWT | JWT 登录支持
|
||||
| Spring Security | 安全框架
|
||||
| Apache Shiro | 安全框架
|
||||
| Redis | 缓存方案
|
||||
| Aliyun OSS | 阿里云对象存储服务(图片存储备选方案)
|
||||
| Lombok | 简化对象封装工具
|
||||
| Docker | 应用容器引擎
|
||||
| MySQL | 数据库服务
|
||||
| Thymeleaf | 模板引擎
|
||||
| Layui | 前端 UI 框架
|
||||
|
||||
## 项目截图
|
||||
|
||||
@ -70,6 +71,42 @@ novel-plus -- 父工程
|
||||
|
||||
https://www.bilibili.com/video/BV18e41197xs
|
||||
|
||||
## AI 功能
|
||||
|
||||
novel-plus 5.x 已集成 Spring 官方最新发布的 Spring AI 框架,并推出多项 AI 功能:
|
||||
|
||||
1. v5.0.0 版本在小说章节发布页面的文本编辑器中集成了多项智能编辑功能,包括 AI 扩写、缩写、续写及文本润色等。这些功能的设计灵感来源于百家号文章编辑器中的 AI 助手。
|
||||
2. v5.1.0 版本在小说发布页面,新增 AI 生成封面图功能。若作家未上传自定义封面图,系统将根据小说信息自动生成封面图。
|
||||
|
||||
目前,AI 功能仍处于实验阶段,仅实现了基础的核心功能。我们非常重视用户的实际使用体验和反馈,未来将根据用户需求和使用情况,持续优化和调整该功能。如果用户反馈积极,我们计划进一步开发更高级的
|
||||
AI 功能,例如自动生成有声小说、智能情节推荐等,以全面提升 novel-plus 的创作能力和用户体验。
|
||||
|
||||
我们将持续关注 AI 技术的发展,并致力于将其与小说创作场景深度融合,为用户带来更智能、更便捷的创作工具。
|
||||
|
||||
由于 DeepSeek 官方 API 目前不可用,novel-plus 项目默认使用的是第三方[硅基流动](https://cloud.siliconflow.cn/i/DOgMRH9S)
|
||||
提供的 API,采用的 AI 模型有对话模型`deepseek-ai/DeepSeek-R1-Distill-Llama-8B`(DeepSeek-R1 的蒸馏版本,免费使用)和生图模型`Kwai-Kolors/Kolors`(快手 Kolors 团队开发的文本到图像生成模型,免费使用)。只需注册一个硅基流动账号,创建一个
|
||||
API 密钥,并将其添加到 novel-plus 项目 novel-front 模块的 yaml 配置文件中,即可体验 novel-plus 项目的 AI 写作功能。
|
||||
|
||||
```yaml
|
||||
spring:
|
||||
ai:
|
||||
openai:
|
||||
image:
|
||||
enabled: true
|
||||
base-url: https://api.siliconflow.cn
|
||||
api-key: sk-rrrupturhdofbiqzjutduuiceecpvfqlnvmgcyiaipbdikoi
|
||||
options:
|
||||
model: Kwai-Kolors/Kolors
|
||||
response_format: URL
|
||||
api-key: sk-rrrupturhdofbiqzjutduuiceecpvfqlnvmgcyiaipbdikoi
|
||||
base-url: https://api.siliconflow.cn
|
||||
chat:
|
||||
options:
|
||||
model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
|
||||
```
|
||||
|
||||
> ⚠️ novel-plus 项目默认使用的都是免费 AI 模型,生成效果有限。如果对生成内容有更高的要求,建议选用付费的 AI 模型。
|
||||
|
||||
## 增值服务
|
||||
|
||||
👉 [了解详情](https://novel.xxyopen.com/service.htm)
|
||||
@ -94,3 +131,5 @@ https://www.bilibili.com/video/BV18e41197xs
|
||||
## 免责声明
|
||||
|
||||
本项目提供的爬虫工具仅用于采集项目初期的测试数据,请勿用于商业盈利。 用户使用本系统从事任何违法违规的事情,一切后果由用户自行承担,作者不承担任何责任。
|
||||
|
||||
|
||||
|
@ -11,13 +11,13 @@ dataSources:
|
||||
ds_1:
|
||||
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
ds_2:
|
||||
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/information_schema?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://localhost:3306/information_schema?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
# 规则配置
|
||||
|
44
doc/sql/20250317.sql
Normal file
@ -0,0 +1,44 @@
|
||||
INSERT INTO crawl_source (source_name, crawl_rule, source_status, create_time, update_time)
|
||||
VALUES ('香书小说网', '{
|
||||
"bookListUrl": "http://www.xbiqugu.la/fenlei/{catId}_{page}.html",
|
||||
"catIdRule": {
|
||||
"catId1": "1",
|
||||
"catId2": "2",
|
||||
"catId3": "3",
|
||||
"catId4": "4",
|
||||
"catId5": "6",
|
||||
"catId6": "5"
|
||||
},
|
||||
"bookIdPatten": "<a\\\\s+href=\\"http://www.xbiqugu.la/(\\\\d+/\\\\d+)/\\"\\\\s+target=\\"_blank\\">",
|
||||
"pagePatten": "<em\\\\s+id=\\"pagestats\\">(\\\\d+)/\\\\d+</em>",
|
||||
"totalPagePatten": "<em\\\\s+id=\\"pagestats\\">\\\\d+/(\\\\d+)</em>",
|
||||
"bookDetailUrl": "http://www.xbiqugu.la/{bookId}/",
|
||||
"bookNamePatten": "<h1>([^/]+)</h1>",
|
||||
"authorNamePatten": "者:([^/]+)</p>",
|
||||
"picUrlPatten": "src=\\"(http://www.xbiqugu.la/files/article/image/\\\\d+/\\\\d+/\\\\d+s\\\\.jpg)\\"",
|
||||
"bookStatusRule": {},
|
||||
"descStart": "<div id=\\"intro\\">",
|
||||
"descEnd": "</div>",
|
||||
"upadateTimePatten": "<p>最后更新:(\\\\d+-\\\\d+-\\\\d+\\\\s\\\\d+:\\\\d+:\\\\d+)</p>",
|
||||
"upadateTimeFormatPatten": "yyyy-MM-dd HH:mm:ss",
|
||||
"bookIndexUrl": "http://www.xbiqugu.la/{bookId}/",
|
||||
"indexIdPatten": "<a\\\\s+href=''/\\\\d+/\\\\d+/(\\\\d+)\\\\.html''\\\\s+>[^/]+</a>",
|
||||
"indexNamePatten": "<a\\\\s+href=''/\\\\d+/\\\\d+/\\\\d+\\\\.html''\\\\s+>([^/]+)</a>",
|
||||
"bookContentUrl": "http://www.xbiqugu.la/{bookId}/{indexId}.html",
|
||||
"contentStart": "<div id=\\"content\\">",
|
||||
"contentEnd": "<p>",
|
||||
"filterContent":"<div\\\\s+id=\\"content_tip\\">\\\\s*<b>([^/]+)</b>\\\\s*</div>"
|
||||
}', 0, '2024-06-01 10:11:39', '2024-06-01 10:11:39');
|
||||
|
||||
|
||||
update crawl_source
|
||||
set crawl_rule = replace(crawl_rule, 'ibiquzw.org', 'biquxs.info')
|
||||
where id = 16;
|
||||
|
||||
delete
|
||||
from sys_menu
|
||||
where menu_id = 104;
|
||||
|
||||
delete
|
||||
from sys_menu
|
||||
where menu_id = 57;
|
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.java2nb</groupId>
|
||||
<artifactId>novel-admin</artifactId>
|
||||
<version>5.0.0</version>
|
||||
<version>5.1.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>novel-admin</name>
|
||||
@ -284,11 +284,6 @@
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${project.build.directory}/build/config" overwrite="true">
|
||||
<fileset dir="${basedir}/../config">
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||
tofile="${project.build.directory}/build/${project.artifactId}.jar"/>
|
||||
|
||||
@ -337,4 +332,35 @@
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- 定义一个用于切换到中央仓库的profile -->
|
||||
<id>central-repo</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>central-plugin</id>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
47
novel-admin/src/main/build/config/shardingsphere-jdbc.yml
Normal file
@ -0,0 +1,47 @@
|
||||
mode:
|
||||
# 单机模式
|
||||
type: Standalone
|
||||
# 元数据持久化
|
||||
repository:
|
||||
# 数据库持久化
|
||||
type: JDBC
|
||||
|
||||
# 数据源配置
|
||||
dataSources:
|
||||
ds_1:
|
||||
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
# 规则配置
|
||||
rules:
|
||||
- !SINGLE
|
||||
tables:
|
||||
- "*.*"
|
||||
- !SHARDING
|
||||
tables: # 数据分片规则配置
|
||||
book_content:
|
||||
# 分库策略,缺省表示使用默认分库策略
|
||||
actualDataNodes: ds_${1}.book_content${0..9}
|
||||
# 分表策略
|
||||
tableStrategy:
|
||||
standard:
|
||||
# 分片列名称
|
||||
shardingColumn: index_id
|
||||
# 分片算法名称
|
||||
shardingAlgorithmName: bookContentSharding
|
||||
|
||||
shardingAlgorithms:
|
||||
bookContentSharding:
|
||||
# 行表达式分片算法,使用 Groovy 的表达式,提供对 SQL 语句中的 = 和 IN 的分片操作支持
|
||||
type: INLINE
|
||||
props:
|
||||
# 分片算法的行表达式
|
||||
algorithm-expression: book_content${index_id % 10}
|
||||
|
||||
|
||||
|
||||
props:
|
||||
# 是否在日志中打印 SQL
|
||||
sql-show: true
|
@ -11,27 +11,37 @@ import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.net.InetAddress;
|
||||
import java.sql.Connection;
|
||||
|
||||
|
||||
@EnableTransactionManagement
|
||||
@ServletComponentScan
|
||||
@MapperScan("com.java2nb.*.dao")
|
||||
@SpringBootApplication(exclude = {
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
})
|
||||
@EnableCaching
|
||||
@Slf4j
|
||||
public class AdminApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(AdminApplication.class, args);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx) {
|
||||
public CommandLineRunner commandLineRunner(ApplicationContext ctx, DataSource dataSource) {
|
||||
return args -> {
|
||||
log.info("项目启动啦,访问路径:{}", "http://" + InetAddress.getLocalHost().getHostAddress() + ":" + ctx.getEnvironment().getProperty("server.port"));
|
||||
log.info("创建连接池...");
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
log.info("连接池已创建.");
|
||||
log.info("数据库:{}", connection.getMetaData().getDatabaseProductName());
|
||||
log.info("数据库版本:{}", connection.getMetaData().getDatabaseProductVersion());
|
||||
}
|
||||
log.info("项目启动啦,访问路径:{}",
|
||||
"http://" + InetAddress.getLocalHost().getHostAddress() + ":" + ctx.getEnvironment()
|
||||
.getProperty("server.port"));
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -27,9 +27,6 @@ spring:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
devtools:
|
||||
restart:
|
||||
enabled: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
|
||||
@ -39,9 +36,6 @@ mybatis:
|
||||
map-underscore-to-camel-case: true
|
||||
mapper-locations: mybatis/**/*Mapper.xml
|
||||
typeAliasesPackage: com.java2nb.**.domain
|
||||
#[弃用]配置缓存和session存储方式,默认ehcache,可选redis,[弃用]调整至 spring cache type【shiro.用户,权限,session,spring.cache通用】
|
||||
#[弃用]cacheType: ehcache
|
||||
|
||||
|
||||
logging:
|
||||
config: classpath:logback-boot.xml
|
||||
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
@ -6,7 +6,7 @@
|
||||
<title>小说精品屋 - 文件管理器</title>
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="/css/animate.css" rel="stylesheet">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<title>403 页面</title>
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="/css/animate.css" rel="stylesheet">
|
||||
|
@ -10,7 +10,7 @@
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
|
||||
<link href="/css/animate.css" rel="stylesheet">
|
||||
|
@ -11,7 +11,7 @@
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
|
||||
<link href="/css/animate.css" rel="stylesheet">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<title>500错误</title>
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<link rel="shortcut icon" href="favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link rel="shortcut icon" href="/favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="/css/animate.css" rel="stylesheet">
|
||||
<link href="/css/style.css?v=4.1.0" rel="stylesheet">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title></title>
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link href="css/bootstrap.min.css?v=3.3.6"
|
||||
th:href="@{/css/bootstrap.min.css?v=3.3.6}" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0"
|
||||
|
@ -10,7 +10,7 @@
|
||||
<!--[if lt IE 9]>
|
||||
<meta http-equiv="refresh" content="0;ie.html"/>
|
||||
<![endif]-->
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="/css/plugins/toastr/toastr.min.css" rel="stylesheet">
|
||||
|
@ -11,7 +11,7 @@
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link href="/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
|
||||
<link href="/css/font-awesome.css?v=4.4.0" rel="stylesheet">
|
||||
<link href="/css/animate.css" rel="stylesheet">
|
||||
|
@ -4,7 +4,7 @@
|
||||
<title></title>
|
||||
<meta name="keywords" content="">
|
||||
<meta name="description" content="">
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="shortcut icon" href="/favicon.ico">
|
||||
<link rel="stylesheet" href="/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="/css/animate.css" />
|
||||
<link rel="stylesheet" href="/css/font-awesome.css" />
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>5.0.0</version>
|
||||
<version>5.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -130,5 +130,29 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>1.8</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<tasks>
|
||||
<zip destfile='${project.build.directory}/build/sql.zip'>
|
||||
<zipfileset filemode="755" dir='${basedir}/../doc/sql'/>
|
||||
</zip>
|
||||
</tasks>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
</project>
|
@ -3,11 +3,19 @@ package com.java2nb.novel.core.advice;
|
||||
import io.github.xxyopen.model.resp.RestResult;
|
||||
import io.github.xxyopen.model.resp.SysResultCode;
|
||||
import io.github.xxyopen.web.exception.BusinessException;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
/**
|
||||
* 统一异常处理器
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
*/
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class CommonExceptionHandler {
|
||||
@ -27,9 +35,21 @@ public class CommonExceptionHandler {
|
||||
return RestResult.fail(e.getResultCode());
|
||||
}
|
||||
|
||||
@ExceptionHandler({Exception.class})
|
||||
public RestResult<Void> handlerException(Exception e) {
|
||||
@ExceptionHandler(Exception.class)
|
||||
public Object handleException(HttpServletRequest request, Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return RestResult.error();
|
||||
if (isJsonRequest(request)) {
|
||||
// 如果是REST请求,返回JSON格式的错误响应
|
||||
return RestResult.error();
|
||||
} else {
|
||||
//跳转页面过程中出现异常时统一跳转到404页面
|
||||
return new ModelAndView("404");
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isJsonRequest(HttpServletRequest request) {
|
||||
String acceptHeader = request.getHeader("Accept");
|
||||
return acceptHeader != null && acceptHeader.contains(MediaType.APPLICATION_JSON_VALUE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
package com.java2nb.novel.core.advice;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 在对 RestController 返回对象 json 序列化时,将所有 Long 类型转为 String 类型返回,避免前端数据精度丢失的问题
|
||||
* 取代 spring.jackson.generator.write-numbers-as-strings=true 配置,避免影响全局的 ObjectMapper
|
||||
*
|
||||
* @author xiongxiaoyang
|
||||
* */
|
||||
@RestControllerAdvice
|
||||
public class CustomResponseBodyAdvice implements ResponseBodyAdvice<Object> {
|
||||
|
||||
private final ObjectMapper customObjectMapper;
|
||||
|
||||
public CustomResponseBodyAdvice(Jackson2ObjectMapperBuilder builder) {
|
||||
customObjectMapper = builder.createXmlMapper(false).build();
|
||||
SimpleModule simpleModule = new SimpleModule();
|
||||
simpleModule.addSerializer(Long.class, ToStringSerializer.instance);
|
||||
simpleModule.addSerializer(Long.TYPE, ToStringSerializer.instance);
|
||||
customObjectMapper.registerModule(simpleModule);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
// 返回 true 表示对所有 Controller 的响应都生效
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
|
||||
// 使用自定义的 ObjectMapper 序列化响应体
|
||||
if(Objects.nonNull(body)) {
|
||||
return customObjectMapper.valueToTree(body);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
package com.java2nb.novel.core.advice;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* 页面异常处理器
|
||||
*
|
||||
* @author 11797
|
||||
*/
|
||||
@Slf4j
|
||||
@ControllerAdvice(basePackages = "com.java2nb.novel.controller.page")
|
||||
public class PageExceptionHandler {
|
||||
|
||||
|
||||
/**
|
||||
* 处理所有异常
|
||||
*/
|
||||
@ExceptionHandler(Exception.class)
|
||||
public String handlerException(Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
//跳转页面过程中出现异常时统一跳转到404页面
|
||||
return "404";
|
||||
}
|
||||
}
|
@ -69,4 +69,8 @@ public interface CacheKey {
|
||||
* 测试爬虫规则缓存
|
||||
*/
|
||||
String BOOK_TEST_PARSE = "testParse";
|
||||
/**
|
||||
* AI生成图片
|
||||
* */
|
||||
String AI_GEN_PIC = "aiGenPic";
|
||||
}
|
||||
|
@ -18,6 +18,11 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
@ -125,5 +130,23 @@ public class FileUtil {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载文件
|
||||
*
|
||||
* @param downloadUrl 下载的URL
|
||||
* @param savePath 保存的路径
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void downloadFile(String downloadUrl, String savePath) {
|
||||
Path path = Paths.get(savePath);
|
||||
Path parentPath = path.getParent();
|
||||
if (Files.notExists(parentPath)) {
|
||||
Files.createDirectories(parentPath);
|
||||
}
|
||||
URL url = new URL(downloadUrl);
|
||||
try (InputStream in = url.openStream()) {
|
||||
Files.copy(in, path, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,18 +2,10 @@ spring:
|
||||
datasource:
|
||||
url: jdbc:shardingsphere:absolutepath:${user.dir}/config/shardingsphere-jdbc.yml
|
||||
driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
|
||||
cache:
|
||||
ehcache:
|
||||
config: classpath:ehcache.xml
|
||||
thymeleaf:
|
||||
mode: LEGACYHTML5 #去除thymeleaf的html严格校验thymeleaf.mode=LEGACYHTML5
|
||||
cache: false # 是否开启模板缓存,默认true,建议在开发时关闭缓存,不然没法看到实时
|
||||
|
||||
# 将所有数字转为 String 类型返回,避免前端数据精度丢失的问题
|
||||
jackson:
|
||||
generator:
|
||||
write-numbers-as-strings: true
|
||||
|
||||
#上传文件的最大值(100M)
|
||||
servlet:
|
||||
multipart:
|
||||
|
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>5.0.0</version>
|
||||
<version>5.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -63,11 +63,6 @@
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${project.build.directory}/build/config" overwrite="true">
|
||||
<fileset dir="${basedir}/../config">
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy file="${project.build.directory}/${project.artifactId}-${project.version}.jar"
|
||||
tofile="${project.build.directory}/build/${project.artifactId}.jar"/>
|
||||
|
||||
|
47
novel-crawl/src/main/build/config/shardingsphere-jdbc.yml
Normal file
@ -0,0 +1,47 @@
|
||||
mode:
|
||||
# 单机模式
|
||||
type: Standalone
|
||||
# 元数据持久化
|
||||
repository:
|
||||
# 数据库持久化
|
||||
type: JDBC
|
||||
|
||||
# 数据源配置
|
||||
dataSources:
|
||||
ds_1:
|
||||
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
# 规则配置
|
||||
rules:
|
||||
- !SINGLE
|
||||
tables:
|
||||
- "*.*"
|
||||
- !SHARDING
|
||||
tables: # 数据分片规则配置
|
||||
book_content:
|
||||
# 分库策略,缺省表示使用默认分库策略
|
||||
actualDataNodes: ds_${1}.book_content${0..9}
|
||||
# 分表策略
|
||||
tableStrategy:
|
||||
standard:
|
||||
# 分片列名称
|
||||
shardingColumn: index_id
|
||||
# 分片算法名称
|
||||
shardingAlgorithmName: bookContentSharding
|
||||
|
||||
shardingAlgorithms:
|
||||
bookContentSharding:
|
||||
# 行表达式分片算法,使用 Groovy 的表达式,提供对 SQL 语句中的 = 和 IN 的分片操作支持
|
||||
type: INLINE
|
||||
props:
|
||||
# 分片算法的行表达式
|
||||
algorithm-expression: book_content${index_id % 10}
|
||||
|
||||
|
||||
|
||||
props:
|
||||
# 是否在日志中打印 SQL
|
||||
sql-show: true
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>novel</artifactId>
|
||||
<groupId>com.java2nb</groupId>
|
||||
<version>5.0.0</version>
|
||||
<version>5.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -90,11 +90,6 @@
|
||||
<include name="application-website.yml"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${project.build.directory}/build/config" overwrite="true">
|
||||
<fileset dir="${basedir}/../config">
|
||||
<include name="*.*"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
<copy todir="${project.build.directory}/build/templates" overwrite="true">
|
||||
<fileset dir="${basedir}/../templates">
|
||||
<include name="**/*.*"/>
|
||||
|
@ -49,3 +49,20 @@ http:
|
||||
# 代理密码
|
||||
password: swiftproxy_p
|
||||
|
||||
|
||||
--- #--------------------- Spring AI 配置----------------------
|
||||
spring:
|
||||
ai:
|
||||
openai:
|
||||
image:
|
||||
enabled: true
|
||||
base-url: https://api.siliconflow.cn
|
||||
api-key: sk-rrrupturhdofbiqzjutduuiceecpvfqlnvmgcyiaipbdikoi
|
||||
options:
|
||||
model: Kwai-Kolors/Kolors
|
||||
response_format: URL
|
||||
api-key: sk-rrrupturhdofbiqzjutduuiceecpvfqlnvmgcyiaipbdikoi
|
||||
base-url: https://api.siliconflow.cn
|
||||
chat:
|
||||
options:
|
||||
model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
|
47
novel-front/src/main/build/config/shardingsphere-jdbc.yml
Normal file
@ -0,0 +1,47 @@
|
||||
mode:
|
||||
# 单机模式
|
||||
type: Standalone
|
||||
# 元数据持久化
|
||||
repository:
|
||||
# 数据库持久化
|
||||
type: JDBC
|
||||
|
||||
# 数据源配置
|
||||
dataSources:
|
||||
ds_1:
|
||||
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
jdbcUrl: jdbc:mysql://localhost:3306/novel_plus?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
password: test123456
|
||||
# 规则配置
|
||||
rules:
|
||||
- !SINGLE
|
||||
tables:
|
||||
- "*.*"
|
||||
- !SHARDING
|
||||
tables: # 数据分片规则配置
|
||||
book_content:
|
||||
# 分库策略,缺省表示使用默认分库策略
|
||||
actualDataNodes: ds_${1}.book_content${0..9}
|
||||
# 分表策略
|
||||
tableStrategy:
|
||||
standard:
|
||||
# 分片列名称
|
||||
shardingColumn: index_id
|
||||
# 分片算法名称
|
||||
shardingAlgorithmName: bookContentSharding
|
||||
|
||||
shardingAlgorithms:
|
||||
bookContentSharding:
|
||||
# 行表达式分片算法,使用 Groovy 的表达式,提供对 SQL 语句中的 = 和 IN 的分片操作支持
|
||||
type: INLINE
|
||||
props:
|
||||
# 分片算法的行表达式
|
||||
algorithm-expression: book_content${index_id % 10}
|
||||
|
||||
|
||||
|
||||
props:
|
||||
# 是否在日志中打印 SQL
|
||||
sql-show: true
|
@ -17,7 +17,14 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.ai.chat.client.ChatClient;
|
||||
import org.springframework.ai.chat.messages.UserMessage;
|
||||
import org.springframework.ai.chat.model.ChatModel;
|
||||
import org.springframework.ai.chat.model.ChatResponse;
|
||||
import org.springframework.ai.chat.prompt.Prompt;
|
||||
import org.springframework.ai.openai.OpenAiChatModel;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -28,7 +35,7 @@ import java.util.Date;
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AuthorController extends BaseController{
|
||||
public class AuthorController extends BaseController {
|
||||
|
||||
private final AuthorService authorService;
|
||||
|
||||
@ -36,62 +43,64 @@ public class AuthorController extends BaseController{
|
||||
|
||||
private final ChatClient chatClient;
|
||||
|
||||
private final OpenAiChatModel chatModel;
|
||||
|
||||
/**
|
||||
* 校验笔名是否存在
|
||||
* */
|
||||
*/
|
||||
@GetMapping("checkPenName")
|
||||
public RestResult<Boolean> checkPenName(String penName){
|
||||
public RestResult<Boolean> checkPenName(String penName) {
|
||||
|
||||
return RestResult.ok(authorService.checkPenName(penName));
|
||||
}
|
||||
|
||||
/**
|
||||
* 作家发布小说分页列表查询
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listBookByPage")
|
||||
public RestResult<PageBean<Book>> listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "10") int pageSize , HttpServletRequest request){
|
||||
public RestResult<PageBean<Book>> listBookByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize, HttpServletRequest request) {
|
||||
|
||||
return RestResult.ok(bookService.listBookPageByUserId(getUserDetails(request).getId(),page,pageSize));
|
||||
return RestResult.ok(bookService.listBookPageByUserId(getUserDetails(request).getId(), page, pageSize));
|
||||
}
|
||||
|
||||
/**
|
||||
* 发布小说
|
||||
* */
|
||||
*/
|
||||
@PostMapping("addBook")
|
||||
public RestResult<Void> addBook(@RequestParam("bookDesc") String bookDesc, Book book, HttpServletRequest request){
|
||||
public RestResult<Void> addBook(@RequestParam("bookDesc") String bookDesc, Book book, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
//bookDesc不能使用book对象来接收,否则会自动去掉前面的空格
|
||||
book.setBookDesc(bookDesc
|
||||
.replaceAll("\\n","<br>")
|
||||
.replaceAll("\\s"," "));
|
||||
.replaceAll("\\n", "<br>")
|
||||
.replaceAll("\\s", " "));
|
||||
//发布小说
|
||||
bookService.addBook(book,author.getId(),author.getPenName());
|
||||
bookService.addBook(book, author.getId(), author.getPenName());
|
||||
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新小说状态,上架或下架
|
||||
* */
|
||||
*/
|
||||
@PostMapping("updateBookStatus")
|
||||
public RestResult<Void> updateBookStatus(Long bookId,Byte status,HttpServletRequest request){
|
||||
public RestResult<Void> updateBookStatus(Long bookId, Byte status, HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
//更新小说状态,上架或下架
|
||||
bookService.updateBookStatus(bookId,status,author.getId());
|
||||
bookService.updateBookStatus(bookId, status, author.getId());
|
||||
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除章节
|
||||
*/
|
||||
@DeleteMapping("deleteIndex/{indexId}")
|
||||
public RestResult<Void> deleteIndex(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
public RestResult<Void> deleteIndex(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
@ -105,7 +114,7 @@ public class AuthorController extends BaseController{
|
||||
* 更新章节名
|
||||
*/
|
||||
@PostMapping("updateIndexName")
|
||||
public RestResult<Void> updateIndexName(Long indexId, String indexName, HttpServletRequest request) {
|
||||
public RestResult<Void> updateIndexName(Long indexId, String indexName, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
@ -116,19 +125,18 @@ public class AuthorController extends BaseController{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发布章节内容
|
||||
*/
|
||||
@PostMapping("addBookContent")
|
||||
public RestResult<Void> addBookContent(Long bookId, String indexName, String content,Byte isVip, HttpServletRequest request) {
|
||||
public RestResult<Void> addBookContent(Long bookId, String indexName, String content, Byte isVip,
|
||||
HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
content = content.replaceAll("\\n", "<br>")
|
||||
.replaceAll("\\s", " ");
|
||||
.replaceAll("\\s", " ");
|
||||
//发布章节内容
|
||||
bookService.addBookContent(bookId, indexName, content,isVip, author.getId());
|
||||
bookService.addBookContent(bookId, indexName, content, isVip, author.getId());
|
||||
|
||||
return RestResult.ok();
|
||||
}
|
||||
@ -137,14 +145,14 @@ public class AuthorController extends BaseController{
|
||||
* 查询章节内容
|
||||
*/
|
||||
@GetMapping("queryIndexContent/{indexId}")
|
||||
public RestResult<String> queryIndexContent(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
public RestResult<String> queryIndexContent(@PathVariable("indexId") Long indexId, HttpServletRequest request) {
|
||||
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
String content = bookService.queryIndexContent(indexId, author.getId());
|
||||
|
||||
content = content.replaceAll("<br>", "\n")
|
||||
.replaceAll(" ", " ");
|
||||
.replaceAll(" ", " ");
|
||||
|
||||
return RestResult.ok(content);
|
||||
}
|
||||
@ -153,11 +161,12 @@ public class AuthorController extends BaseController{
|
||||
* 更新章节内容
|
||||
*/
|
||||
@PostMapping("updateBookContent")
|
||||
public RestResult<Void> updateBookContent(Long indexId, String indexName, String content, HttpServletRequest request) {
|
||||
public RestResult<Void> updateBookContent(Long indexId, String indexName, String content,
|
||||
HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
|
||||
content = content.replaceAll("\\n", "<br>")
|
||||
.replaceAll("\\s", " ");
|
||||
.replaceAll("\\s", " ");
|
||||
//更新章节内容
|
||||
bookService.updateBookContent(indexId, indexName, content, author.getId());
|
||||
|
||||
@ -168,38 +177,44 @@ public class AuthorController extends BaseController{
|
||||
* 修改小说封面
|
||||
*/
|
||||
@PostMapping("updateBookPic")
|
||||
public RestResult<Void> updateBookPic(@RequestParam("bookId") Long bookId,@RequestParam("bookPic") String bookPic,HttpServletRequest request) {
|
||||
public RestResult<Void> updateBookPic(@RequestParam("bookId") Long bookId, @RequestParam("bookPic") String bookPic,
|
||||
HttpServletRequest request) {
|
||||
Author author = checkAuthor(request);
|
||||
bookService.updateBookPic(bookId,bookPic, author.getId());
|
||||
bookService.updateBookPic(bookId, bookPic, author.getId());
|
||||
return RestResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作家日收入统计数据分页列表查询
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listIncomeDailyByPage")
|
||||
public RestResult<PageBean<AuthorIncomeDetail>> listIncomeDailyByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
@RequestParam(value = "startTime",defaultValue = "2020-05-01") Date startTime,
|
||||
@RequestParam(value = "endTime",defaultValue = "2030-01-01") Date endTime,
|
||||
HttpServletRequest request){
|
||||
public RestResult<PageBean<AuthorIncomeDetail>> listIncomeDailyByPage(
|
||||
@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
@RequestParam(value = "startTime", defaultValue = "2020-05-01") Date startTime,
|
||||
@RequestParam(value = "endTime", defaultValue = "2030-01-01") Date endTime,
|
||||
HttpServletRequest request) {
|
||||
|
||||
return RestResult.ok(authorService.listIncomeDailyByPage(page,pageSize,getUserDetails(request).getId(),bookId,startTime,endTime));
|
||||
return RestResult.ok(
|
||||
authorService.listIncomeDailyByPage(page, pageSize, getUserDetails(request).getId(), bookId, startTime,
|
||||
endTime));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 作家月收入统计数据分页列表查询
|
||||
* */
|
||||
*/
|
||||
@GetMapping("listIncomeMonthByPage")
|
||||
public RestResult<PageBean<AuthorIncome>> listIncomeMonthByPage(@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize ,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
HttpServletRequest request){
|
||||
public RestResult<PageBean<AuthorIncome>> listIncomeMonthByPage(
|
||||
@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "10") int pageSize,
|
||||
@RequestParam(value = "bookId", defaultValue = "0") Long bookId,
|
||||
HttpServletRequest request) {
|
||||
|
||||
return RestResult.ok(authorService.listIncomeMonthByPage(page,pageSize,getUserDetails(request).getId(),bookId));
|
||||
return RestResult.ok(
|
||||
authorService.listIncomeMonthByPage(page, pageSize, getUserDetails(request).getId(), bookId));
|
||||
}
|
||||
|
||||
private Author checkAuthor(HttpServletRequest request) {
|
||||
@ -218,22 +233,29 @@ public class AuthorController extends BaseController{
|
||||
throw new BusinessException(ResponseStatus.AUTHOR_STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
|
||||
return author;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询AI生成图片
|
||||
*/
|
||||
@GetMapping("queryAiGenPic")
|
||||
public RestResult<String> queryAiGenPic(@RequestParam("bookId") Long bookId) {
|
||||
return RestResult.ok(bookService.queryAiGenPic(bookId));
|
||||
}
|
||||
|
||||
/**
|
||||
* AI扩写
|
||||
*/
|
||||
@PostMapping("ai/expand")
|
||||
public RestResult<String> expandText(@RequestParam("text") String text, @RequestParam("ratio") Double ratio) {
|
||||
String prompt = "请将以下文本扩写为原长度的" + ratio/100 + "倍:" + text;
|
||||
String prompt = "请将以下文本扩写为原长度的" + ratio / 100 + "倍:" + text;
|
||||
return RestResult.ok(chatClient.prompt()
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -241,11 +263,11 @@ public class AuthorController extends BaseController{
|
||||
*/
|
||||
@PostMapping("ai/condense")
|
||||
public RestResult<String> condenseText(@RequestParam("text") String text, @RequestParam("ratio") Integer ratio) {
|
||||
String prompt = "请将以下文本缩写为原长度的" + 100/ratio + "分之一:" + text;
|
||||
String prompt = "请将以下文本缩写为原长度的" + 100 / ratio + "分之一:" + text;
|
||||
return RestResult.ok(chatClient.prompt()
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -255,9 +277,9 @@ public class AuthorController extends BaseController{
|
||||
public RestResult<String> continueText(@RequestParam("text") String text, @RequestParam("length") Integer length) {
|
||||
String prompt = "请续写以下文本,续写长度约为" + length + "字:" + text;
|
||||
return RestResult.ok(chatClient.prompt()
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
}
|
||||
|
||||
/**
|
||||
@ -267,12 +289,57 @@ public class AuthorController extends BaseController{
|
||||
public RestResult<String> polishText(@RequestParam("text") String text) {
|
||||
String prompt = "请润色优化以下文本,保持原意:" + text;
|
||||
return RestResult.ok(chatClient.prompt()
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
.user(prompt)
|
||||
.call()
|
||||
.content());
|
||||
}
|
||||
|
||||
/**
|
||||
* AI扩写
|
||||
*/
|
||||
@GetMapping(value = "ai/stream/expand", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<String> streamExpandText(@RequestParam("text") String text, @RequestParam("ratio") Double ratio) {
|
||||
String prompt = "请将以下文本扩写为原长度的" + ratio / 100 + "倍:" + text;
|
||||
return chatClient.prompt()
|
||||
.user(prompt)
|
||||
.stream()
|
||||
.content();
|
||||
}
|
||||
|
||||
/**
|
||||
* AI缩写
|
||||
*/
|
||||
@GetMapping(value = "ai/stream/condense", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<String> streamCondenseText(@RequestParam("text") String text, @RequestParam("ratio") Integer ratio) {
|
||||
String prompt = "请将以下文本缩写为原长度的" + 100 / ratio + "分之一:" + text;
|
||||
return chatClient.prompt()
|
||||
.user(prompt)
|
||||
.stream()
|
||||
.content();
|
||||
}
|
||||
|
||||
/**
|
||||
* AI续写
|
||||
*/
|
||||
@GetMapping(value = "ai/stream/continue", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<String> streamContinueText(@RequestParam("text") String text, @RequestParam("length") Integer length) {
|
||||
String prompt = "请续写以下文本,续写长度约为" + length + "字:" + text;
|
||||
return chatClient.prompt()
|
||||
.user(prompt)
|
||||
.stream()
|
||||
.content();
|
||||
}
|
||||
|
||||
/**
|
||||
* AI润色
|
||||
*/
|
||||
@GetMapping(value = "/ai/stream/polish", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
|
||||
public Flux<String> streamPolishText(@RequestParam("text") String text) {
|
||||
String prompt = "请润色优化以下文本,保持原意:" + text;
|
||||
return chatClient.prompt()
|
||||
.user(prompt)
|
||||
.stream()
|
||||
.content();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.http.client.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@ -61,11 +62,20 @@ public class FileController {
|
||||
/**
|
||||
* 图片上传
|
||||
*
|
||||
* @return
|
||||
* - 当使用 `$.ajax`发起异步请求时 ,设置`dataType: "json"`会在请求头中自动添加`Accept: application/json`,表示客户端期望服务器返回
|
||||
* `JSON`格式的数据。
|
||||
* - 当使用 `$.ajaxFileUpload` 上传文件时,它的行为与`$.ajax`不同,不会自动修改`Accept`请求头,即使设置了`dataType: "json"`,
|
||||
* `$.ajaxFileUpload`也不会在请求头中添加`Accept: application/json`。
|
||||
*
|
||||
* Spring Boot 默认返回`JSON`格式的响应,但它支持内容协商,它会根据客户端请求的`Accept`头来决定返回的响应格式。
|
||||
* 如果浏览器发送的请求中`Accept`头包含`application/xml`,并且 Spring Boot 支持`XML`格式响应的话,Spring Boot 会返回`XML`格式的响应。
|
||||
* 但 Spring Boot 默认不支持`XML`格式的响应,当升级`Sharding-JDBC `版本后,自动引入了`jackson-dataformat-xml`依赖,才开始支持`XML`格式的响应,
|
||||
* 由于`$.ajaxFileUpload`上传文件的默认`Accept`头包含`application/xml`,所以需要在后端上传文件接口处明确指定返回的数据类型为`application/json`。
|
||||
*
|
||||
*/
|
||||
@SneakyThrows
|
||||
@ResponseBody
|
||||
@PostMapping("/picUpload")
|
||||
@PostMapping(value = "/picUpload", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
RestResult<String> upload(@RequestParam("file") MultipartFile file) {
|
||||
Date currentDate = new Date();
|
||||
String savePath =
|
||||
|
@ -18,16 +18,7 @@ import org.springframework.web.client.RestClient;
|
||||
public class AiConfig {
|
||||
|
||||
/**
|
||||
* 目的:配置自定义的 RestClientBuilder 对象
|
||||
* <p>
|
||||
* 原因:Spring AI 框架的 ChatClient 内部通过 RestClient(Spring Framework 6 和 Spring Boot 3 中引入) 发起 HTTP REST 请求与远程的大模型服务进行通信,
|
||||
* 如果项目中没有配置自定义的 RestClientBuilder 对象, 那么在 RestClient 的自动配置类 org.springframework.boot.autoconfigure.web.client.RestClientAutoConfiguration
|
||||
* 中配置的 RestClientBuilder 对象会使用 Spring 容器中提供的 HttpMessageConverters, 由于本项目中配置了 spring.jackson.generator.write-numbers-as-strings
|
||||
* = true, 所以 Spring 容器中的 HttpMessageConverters 在 RestClient 发起 HTTP REST 请求转换 Java 对象为 JSON 字符串时会自动将 Number 类型的
|
||||
* Java 对象属性转换为字符串而导致请求参数错误
|
||||
* <p>
|
||||
* 示例:"temperature": 0.7 =》"temperature": "0.7"
|
||||
* {"code":20015,"message":"The parameter is invalid. Please check again.","data":null}
|
||||
* 配置自定义的 RestClientBuilder 对象
|
||||
*/
|
||||
@Bean
|
||||
public RestClient.Builder restClientBuilder() {
|
||||
|
@ -290,4 +290,9 @@ public interface BookService {
|
||||
* @param authorId
|
||||
*/
|
||||
void updateBookPic(Long bookId, String bookPic, Long authorId);
|
||||
|
||||
/**
|
||||
* 查询AI生成图片
|
||||
*/
|
||||
String queryAiGenPic(Long bookId);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.java2nb.novel.core.cache.CacheService;
|
||||
import com.java2nb.novel.core.config.BookPriceProperties;
|
||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||
import com.java2nb.novel.core.utils.Constants;
|
||||
import com.java2nb.novel.core.utils.FileUtil;
|
||||
import com.java2nb.novel.core.utils.StringUtil;
|
||||
import com.java2nb.novel.entity.Book;
|
||||
import com.java2nb.novel.entity.*;
|
||||
@ -27,10 +28,16 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.client.utils.DateUtils;
|
||||
import org.mybatis.dynamic.sql.SortSpecification;
|
||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||
import org.mybatis.dynamic.sql.select.QueryExpressionDSL;
|
||||
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||
import org.springframework.ai.image.Image;
|
||||
import org.springframework.ai.image.ImagePrompt;
|
||||
import org.springframework.ai.image.ImageResponse;
|
||||
import org.springframework.ai.openai.OpenAiImageModel;
|
||||
import org.springframework.ai.openai.OpenAiImageOptions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -39,13 +46,16 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.java2nb.novel.mapper.BookCategoryDynamicSqlSupport.bookCategory;
|
||||
import static com.java2nb.novel.mapper.BookCategoryDynamicSqlSupport.sort;
|
||||
import static com.java2nb.novel.mapper.BookCommentDynamicSqlSupport.bookComment;
|
||||
import static com.java2nb.novel.mapper.BookContentDynamicSqlSupport.bookContent;
|
||||
import static com.java2nb.novel.mapper.BookContentDynamicSqlSupport.content;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.*;
|
||||
import static com.java2nb.novel.mapper.BookDynamicSqlSupport.book;
|
||||
import static com.java2nb.novel.mapper.BookIndexDynamicSqlSupport.bookIndex;
|
||||
import static com.java2nb.novel.mapper.BookSettingDynamicSqlSupport.bookSetting;
|
||||
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||
@ -87,6 +97,10 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
private final BookPriceProperties bookPriceConfig;
|
||||
|
||||
private final OpenAiImageModel openAiImageModel;
|
||||
|
||||
private final ThreadPoolExecutor threadPoolExecutor;
|
||||
|
||||
private final IdWorker idWorker = IdWorker.INSTANCE;
|
||||
|
||||
|
||||
@ -102,7 +116,7 @@ public class BookServiceImpl implements BookService {
|
||||
}
|
||||
result = new ObjectMapper().writeValueAsString(
|
||||
list.stream().collect(Collectors.groupingBy(BookSettingVO::getType)));
|
||||
cacheService.set(CacheKey.INDEX_BOOK_SETTINGS_KEY, result);
|
||||
cacheService.set(CacheKey.INDEX_BOOK_SETTINGS_KEY, result, 3600 * 24);
|
||||
}
|
||||
return new ObjectMapper().readValue(result, Map.class);
|
||||
}
|
||||
@ -235,7 +249,7 @@ public class BookServiceImpl implements BookService {
|
||||
BookIndexDynamicSqlSupport.isVip)
|
||||
.from(bookIndex)
|
||||
.where(BookIndexDynamicSqlSupport.bookId, isEqualTo(bookId));
|
||||
if("index_num desc".equals(orderBy)){
|
||||
if ("index_num desc".equals(orderBy)) {
|
||||
where.orderBy(BookIndexDynamicSqlSupport.indexNum.descending());
|
||||
}
|
||||
return bookIndexMapper.selectMany(where
|
||||
@ -502,6 +516,7 @@ public class BookServiceImpl implements BookService {
|
||||
|
||||
@Override
|
||||
public void addBook(Book book, Long authorId, String penName) {
|
||||
book.setId(IdWorker.INSTANCE.nextId());
|
||||
//判断小说名是否存在
|
||||
if (queryIdByNameAndAuthor(book.getBookName(), penName) != null) {
|
||||
//该作者发布过此书名的小说
|
||||
@ -516,7 +531,37 @@ public class BookServiceImpl implements BookService {
|
||||
book.setCreateTime(new Date());
|
||||
book.setUpdateTime(book.getCreateTime());
|
||||
bookMapper.insertSelective(book);
|
||||
|
||||
if (Objects.isNull(book.getPicUrl()) || !book.getPicUrl().startsWith(Constants.LOCAL_PIC_PREFIX)) {
|
||||
// 用户没有上传封面图片,AI自动生成封面图片
|
||||
threadPoolExecutor.execute(() -> {
|
||||
String prompt = String.format("生成一本小说的封面图片,图片中间显示书名《%s》,书名下方显示作者“%s 著”。",
|
||||
book.getBookName(), book.getAuthorName());
|
||||
log.debug("prompt:{}", prompt);
|
||||
ImageResponse response = openAiImageModel.call(
|
||||
new ImagePrompt(prompt,
|
||||
OpenAiImageOptions.builder()
|
||||
.quality("hd")
|
||||
.height(800)
|
||||
.width(600).build())
|
||||
);
|
||||
Image output = response.getResult().getOutput();
|
||||
Date currentDate = new Date();
|
||||
String picUrl = Constants.LOCAL_PIC_PREFIX +
|
||||
"aiGen/" + DateUtils.formatDate(currentDate, "yyyy") + "/" +
|
||||
DateUtils.formatDate(currentDate, "MM") + "/" +
|
||||
DateUtils.formatDate(currentDate, "dd") + "/" + book.getId() + ".png";
|
||||
FileUtil.downloadFile(output.getUrl(), picSavePath + picUrl);
|
||||
bookMapper.update(update(BookDynamicSqlSupport.book)
|
||||
.set(BookDynamicSqlSupport.picUrl)
|
||||
.equalTo(picUrl)
|
||||
.set(updateTime)
|
||||
.equalTo(currentDate)
|
||||
.where(id, isEqualTo(book.getId()))
|
||||
.build()
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
cacheService.set(CacheKey.AI_GEN_PIC + book.getId(), picUrl, 60 * 60);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -838,5 +883,10 @@ public class BookServiceImpl implements BookService {
|
||||
.render(RenderingStrategies.MYBATIS3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String queryAiGenPic(Long bookId) {
|
||||
return cacheService.get(CacheKey.AI_GEN_PIC + bookId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -3,12 +3,13 @@ spring:
|
||||
import: classpath:application-common-prod.yml
|
||||
|
||||
#静态文件路径配置
|
||||
resources:
|
||||
static-locations: file:${user.dir}/templates/${templates.name}/static/
|
||||
#thymeleaf模版路径配置
|
||||
thymeleaf:
|
||||
prefix: file:${user.dir}/templates/${templates.name}/html/
|
||||
suffix: .html
|
||||
web:
|
||||
resources:
|
||||
static-locations: file:${user.dir}/templates/${templates.name}/static/
|
||||
|
||||
#模版配置
|
||||
templates:
|
||||
|
@ -48,13 +48,17 @@ book:
|
||||
spring:
|
||||
ai:
|
||||
openai:
|
||||
api-key: sk-nnhjmxuljagcuubbovjztbhkiawqaabzziazeurppinxtgva
|
||||
image:
|
||||
enabled: true
|
||||
base-url: https://api.siliconflow.cn
|
||||
api-key: sk-jjtixmivxaccndqgkqfkbgkzvmbctdxogcrfbjzfttbouitt
|
||||
options:
|
||||
model: Kwai-Kolors/Kolors
|
||||
response_format: URL
|
||||
api-key: sk-jjtixmivxaccndqgkqfkbgkzvmbctdxogcrfbjzfttbouitt
|
||||
base-url: https://api.siliconflow.cn
|
||||
chat:
|
||||
options:
|
||||
model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
@ -15,7 +15,7 @@
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0,0,0,.1);
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
/* 文本域样式 */
|
||||
@ -124,10 +124,10 @@
|
||||
<li id="contentLi" style="width: 500px">
|
||||
<div class="editor-container">
|
||||
<div class="ai-toolbar">
|
||||
<a class="ai-link expand" data-type="expand">AI扩写</a>
|
||||
<a class="ai-link condense" data-type="condense">AI缩写</a>
|
||||
<a class="ai-link continue" data-type="continue">AI续写</a>
|
||||
<a class="ai-link polish" data-type="polish">AI润色</a>
|
||||
<a class="ai-link expand" data-type="stream/expand">AI扩写</a>
|
||||
<a class="ai-link condense" data-type="stream/condense">AI缩写</a>
|
||||
<a class="ai-link continue" data-type="stream/continue">AI续写</a>
|
||||
<a class="ai-link polish" data-type="stream/polish">AI润色</a>
|
||||
</div>
|
||||
<textarea id="bookContent" name="bookContent"
|
||||
placeholder="请输入文本内容..."></textarea>
|
||||
@ -268,7 +268,7 @@
|
||||
}, speed);
|
||||
}
|
||||
|
||||
$('.ai-toolbar .ai-link').click(function(e){
|
||||
$('.ai-toolbar .ai-link').click(function (e) {
|
||||
e.preventDefault(); // 阻止默认链接行为
|
||||
const type = $(this).data('type');
|
||||
const textarea = $('#bookContent');
|
||||
@ -284,27 +284,27 @@
|
||||
|
||||
// 参数配置
|
||||
let params = {text: selectedText};
|
||||
if(type === 'expand' || type === 'condense'){
|
||||
if (type === 'stream/expand' || type === 'stream/condense') {
|
||||
layer.prompt({
|
||||
title: '请输入比例',
|
||||
value: 2,
|
||||
btn: ['确定', '取消'],
|
||||
btn2: function(){
|
||||
btn2: function () {
|
||||
layer.close(loading);
|
||||
},
|
||||
cancel: function(){
|
||||
cancel: function () {
|
||||
layer.close(loading);
|
||||
}
|
||||
}, function(value, index){
|
||||
if(isNaN(Number(value)) || isNaN(parseFloat(value))){
|
||||
}, function (value, index) {
|
||||
if (isNaN(Number(value)) || isNaN(parseFloat(value))) {
|
||||
layer.msg('请输入正确的比例');
|
||||
return;
|
||||
}
|
||||
if(type === 'expand' && value <= 1){
|
||||
if (type === 'stream/expand' && value <= 1) {
|
||||
layer.msg('请输入正确的比例');
|
||||
return;
|
||||
}
|
||||
if(type === 'condense' && (value <=0 || value >= 1)){
|
||||
if (type === 'stream/condense' && (value <= 0 || value >= 1)) {
|
||||
layer.msg('请输入正确的比例');
|
||||
return;
|
||||
}
|
||||
@ -313,19 +313,19 @@
|
||||
sendRequest(type, params, loading, textarea);
|
||||
});
|
||||
return;
|
||||
}else if(type === 'continue'){
|
||||
} else if (type === 'stream/continue') {
|
||||
layer.prompt({
|
||||
title: '请输入续写长度(字数)',
|
||||
value: 200,
|
||||
btn: ['确定', '取消'],
|
||||
btn2: function(){
|
||||
btn2: function () {
|
||||
layer.close(loading);
|
||||
},
|
||||
cancel: function(){
|
||||
cancel: function () {
|
||||
layer.close(loading);
|
||||
}
|
||||
}, function(value, index){
|
||||
if(!Number.isInteger(Number(value)) || value <= 0){
|
||||
}, function (value, index) {
|
||||
if (!Number.isInteger(Number(value)) || value <= 0) {
|
||||
layer.msg('请输入正确的长度');
|
||||
return;
|
||||
}
|
||||
@ -339,22 +339,28 @@
|
||||
sendRequest(type, params, loading, textarea);
|
||||
});
|
||||
|
||||
function sendRequest(type, params, loading, textarea){
|
||||
$.ajax({
|
||||
url: '/author/ai/' + type,
|
||||
type: 'POST',
|
||||
data: params,
|
||||
success: function(res){
|
||||
layer.close(loading);
|
||||
// 将生成的内容追加到文本末尾
|
||||
const newText = "\n\n" + res.data; // 添加换行符分隔
|
||||
typeWriter(textarea, newText); // 使用打字机效果
|
||||
},
|
||||
error: function(){
|
||||
layer.msg('请求失败,请稍后重试');
|
||||
layer.close(loading);
|
||||
}
|
||||
});
|
||||
function sendRequest(type, params, loading, textarea) {
|
||||
const url = `/author/ai/${type}?text=${encodeURIComponent(params.text)}&ratio=${params.ratio}&length=${params.length}`;
|
||||
const eventSource = new EventSource(url);
|
||||
|
||||
// 监听消息事件
|
||||
eventSource.onmessage = function (event) {
|
||||
layer.close(loading);
|
||||
const data = event.data;
|
||||
console.log('Received data:', data);
|
||||
|
||||
textarea.val(textarea.val() + data);
|
||||
// 滚动到底部
|
||||
textarea.scrollTop(textarea[0].scrollHeight);
|
||||
};
|
||||
|
||||
// 监听错误事件
|
||||
eventSource.onerror = function (error) {
|
||||
layer.close(loading);
|
||||
console.error('EventSource failed:', error);
|
||||
eventSource.close(); // 关闭连接
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
@ -142,10 +142,12 @@
|
||||
<script src="/javascript/common.js" type="text/javascript"></script>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
var coverUpdateInterval;
|
||||
|
||||
search(1, 5);
|
||||
|
||||
function search(curr, limit) {
|
||||
|
||||
clearInterval(coverUpdateInterval);
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/author/listBookByPage",
|
||||
@ -155,6 +157,25 @@
|
||||
if (data.code == 200) {
|
||||
var bookList = data.data.list;
|
||||
if (bookList.length > 0) {
|
||||
if(curr == 1 && bookList[0].picUrl == '/images/default.gif'){
|
||||
coverUpdateInterval = setInterval(function(){
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/author/queryAiGenPic",
|
||||
data: {'bookId': bookList[0].id},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if(data.code == 200 && data.data){
|
||||
$("#cover"+bookList[0].id).attr("src", data.data);
|
||||
clearInterval(coverUpdateInterval);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, 3000);
|
||||
setTimeout(() => {
|
||||
clearInterval(coverUpdateInterval);
|
||||
}, 10000);
|
||||
}
|
||||
$("#hasContentDiv").css("display", "block");
|
||||
$("#noContentDiv").css("display", "none");
|
||||
var bookListHtml = "";
|
||||
@ -166,15 +187,12 @@
|
||||
" </td>\n" +*/
|
||||
|
||||
" <td style=\"position: relative\" class=\"goread\">\n" +
|
||||
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "'," + i + ")\"\n" +
|
||||
" type=\"file\" id=\"file" + i + "\" name=\"file\"\n" +
|
||||
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "')\"\n" +
|
||||
" type=\"file\" id=\"file" + book.id + "\" name=\"file\"\n" +
|
||||
" title=\"点击上传图片\"\n" +
|
||||
" style=\"z-index: 100;cursor: pointer;left: 30px; top: 0px; width: 60px; height: 80px; opacity: 0; position: absolute; \"\n" +
|
||||
" />" +
|
||||
"<img width='50' height='70' src='" + book.picUrl + "'/><br/>" +
|
||||
" " + book.bookName + "</td>\n" +
|
||||
|
||||
|
||||
"<img id=\"cover" + book.id + "\" width='50' height='70' src='" + book.picUrl + "'/><br/>" + " " + book.bookName + "</td>\n" +
|
||||
" <td class=\"goread\" >"
|
||||
+ book.catName + "</td>\n" +
|
||||
|
||||
@ -277,19 +295,20 @@
|
||||
}
|
||||
|
||||
|
||||
function picChange(bookId, i) {
|
||||
var file = $("#file" + i).val(); //文件名称
|
||||
function picChange(bookId) {
|
||||
var file = $("#file" + bookId).val(); //文件名称
|
||||
if (file != "") {
|
||||
if (checkPicUpload($("#file" + i)[0])) {
|
||||
if (checkPicUpload($("#file" + bookId)[0])) {
|
||||
|
||||
$.ajaxFileUpload({
|
||||
url: "/file/picUpload", //用于文件上传的服务器端请求地址
|
||||
secureuri: false, //是否需要安全协议,一般设置为false
|
||||
fileElementId: "file" + i, //文件上传域的ID
|
||||
fileElementId: "file" + bookId, //文件上传域的ID
|
||||
dataType: "json", //返回值类型 一般设置为json
|
||||
type: "post",
|
||||
success: function (data) { //服务器成功响应处理函数
|
||||
if (data.code == 200) {
|
||||
let picUrl = data.data;
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/author/updateBookPic",
|
||||
@ -297,17 +316,13 @@
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
|
||||
location.reload();
|
||||
|
||||
$("#cover"+bookId).attr("src", picUrl);
|
||||
} else {
|
||||
lock = false;
|
||||
layer.alert(data.msg);
|
||||
}
|
||||
|
||||
},
|
||||
error: function () {
|
||||
lock = false;
|
||||
layer.alert('网络异常');
|
||||
}
|
||||
})
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="keywords" th:content="${application.website.name}+',小说,小说网,言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,原创网络文学'"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.name}+'每日更新小说连载,小说排行榜,提供言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,首发小说,最新章节免费小说阅读,精彩尽在'+${application.website.name}+'。'"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -7,8 +7,8 @@
|
||||
<meta name="keywords" th:content="${application.website.keyword}"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.description}"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -20,6 +20,22 @@
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
|
||||
-webkit-user-select: none; /* Chrome, Safari, Opera */
|
||||
|
||||
|
||||
-moz-user-select: none; /* Firefox */
|
||||
|
||||
|
||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||
|
||||
|
||||
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.line-limit-length {
|
||||
|
||||
@ -62,11 +78,21 @@
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
#tipLayer {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: rgba(255, 0, 0, 0.8);
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<input type="hidden" id="limit" th:value="${limit}"/>
|
||||
<input type="hidden" id="curr" th:value="${curr}"/>
|
||||
<input type="hidden" id="total" th:value="${total}"/>
|
||||
@ -95,6 +121,10 @@
|
||||
|
||||
|
||||
</div>
|
||||
<div id="tipLayer"
|
||||
style="display:none; position:absolute; background-color:rgba(255, 0, 0, 0.8); color:white; padding:5px; border-radius:3px; cursor:pointer;">
|
||||
移出书架
|
||||
</div>
|
||||
|
||||
|
||||
<div id="books" style="text-align: center;"></div>
|
||||
@ -105,11 +135,12 @@
|
||||
|
||||
<a name="buttom"></a>
|
||||
</body>
|
||||
|
||||
<div th:replace="mobile/common/js :: js"></div>
|
||||
|
||||
<script>
|
||||
|
||||
var timeout, isLongPress = false;
|
||||
|
||||
search(1, 20);
|
||||
|
||||
function search(curr, limit) {
|
||||
@ -136,22 +167,16 @@
|
||||
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
||||
}
|
||||
|
||||
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||
" <a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>\n" +
|
||||
bookListHtml += ("<div id='" + book.bookId + "' onclick='read(\"" + book.bookId + "\",\"" + book.preContentId + "\")' class=\"item layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||
" <div class=\"layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
|
||||
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
|
||||
" src=\"" + book.picUrl + "\"/>\n" +
|
||||
"\n" +
|
||||
" </div>\n" +
|
||||
" </a>\n" +
|
||||
" \n" +
|
||||
" <div style=\"padding: 10px\" class=\"layui-col-xs6 layui-col-sm8 layui-col-md8 layui-col-lg8\">\n" +
|
||||
" <a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>\n" +
|
||||
" <div class=\"line-limit-length\" style=\";color: #000;font-size: 15px\">" + book.bookName + "</div>\n" +
|
||||
" </a>\n" +
|
||||
" <div style=\";color: #4c6978;float: right;\"><i style=\"color: red\"></i></div>\n" +
|
||||
" <a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>\n" +
|
||||
" <div style=\";color: #a6a6a6;\" class=\"line-limit-length\">作者:" + book.authorName + "</div>\n" +
|
||||
" </a>\n" +
|
||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">类别:" + book.catName + "</div>\n" +
|
||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "</div>\n" +
|
||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">更新:<i style='color: red'>" + book.lastIndexUpdateTime.substr(0, 11) + "</i>\n" +
|
||||
@ -165,6 +190,41 @@
|
||||
}
|
||||
$("#bookList").html(bookListHtml);
|
||||
|
||||
|
||||
$(".item").on('touchstart', function (e) {
|
||||
var element = $(this);
|
||||
// 清除可能存在的定时器
|
||||
clearTimeout(timeout);
|
||||
isLongPress = false;
|
||||
|
||||
// 获取触摸点位置
|
||||
var touch = e.originalEvent.touches[0];
|
||||
|
||||
// 设置一个定时器,在500ms后触发(可以根据需要调整时间)
|
||||
timeout = setTimeout(function () {
|
||||
e.preventDefault();
|
||||
showTip(touch, element);
|
||||
}, 1000);
|
||||
}).on('touchend', function (e) {
|
||||
if (!isLongPress) {
|
||||
// 如果没有发生长按,则执行点击事件的逻辑
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}).on('touchmove', function () {
|
||||
clearTimeout(timeout);
|
||||
hideTip();
|
||||
}).on('contextmenu', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('#tipLayer').click(function () {
|
||||
// 点击tips层时删除对应的.item元素
|
||||
removeFromBookShelf($(this).data('target').attr("id"));
|
||||
$(this).data('target').remove();
|
||||
hideTip();
|
||||
});
|
||||
|
||||
|
||||
layui.use('laypage', function () {
|
||||
var laypage = layui.laypage;
|
||||
|
||||
@ -203,6 +263,23 @@
|
||||
|
||||
}
|
||||
|
||||
function showTip(touchEvent, element) {
|
||||
isLongPress = true;
|
||||
// 根据触摸点位置设置弹出层的位置
|
||||
$('#tipLayer')
|
||||
.css({
|
||||
top: touchEvent.pageY - 100, // 调整这个值以改变弹出层相对于触摸点的位置
|
||||
left: touchEvent.pageX - ($('#tipLayer').outerWidth() / 2)
|
||||
})
|
||||
.data('target', element) // 存储目标元素以便后续操作
|
||||
.show();
|
||||
}
|
||||
|
||||
function hideTip() {
|
||||
isLongPress = false;
|
||||
$('#tipLayer').hide().removeData('target'); // 隐藏tips并清除数据
|
||||
}
|
||||
|
||||
|
||||
function searchByAllCondition(curr, limit, newKeyword) {
|
||||
var toUrl = "/book/search?curr=" + curr + "&limit=" + limit;
|
||||
@ -248,18 +325,35 @@
|
||||
searchByAllCondition(1, 20, keywords);
|
||||
}
|
||||
|
||||
function read(bookId, contentId) {
|
||||
if (isLongPress) {
|
||||
return false;
|
||||
}
|
||||
location.href = '/book/' + bookId + "/" + contentId + ".html"
|
||||
hideTip();
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
|
||||
function toMyCollect() {
|
||||
var token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
window.location.href = "/book/search?token=" + token;
|
||||
} else {
|
||||
window.location.href = "/user/login.html";
|
||||
}
|
||||
function removeFromBookShelf(bookId) {
|
||||
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "/user/removeFromBookShelf/" + bookId,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
$("#shelf" + bookId).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
更新时间
|
||||
</th>
|
||||
<th class="goread">
|
||||
书签
|
||||
操作
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -94,7 +94,7 @@
|
||||
var bookShelfListHtml = "";
|
||||
for (var i = 0; i < bookShelfList.length; i++) {
|
||||
var book = bookShelfList[i];
|
||||
bookShelfListHtml += (" <tr class=\"book_list\" vals=\"291\">\n" +
|
||||
bookShelfListHtml += (" <tr id='shelf" + book.bookId + "' class=\"book_list\" vals=\"291\">\n" +
|
||||
" <td class=\"style bookclass\">\n" +
|
||||
" <a href=\"/book/bookclass.html?c=" + book.catId + "\" >[" + book.catName + "]</a>\n" +
|
||||
" </td>\n" +
|
||||
@ -109,7 +109,8 @@
|
||||
" " + book.lastIndexUpdateTime + "\n" +
|
||||
" </td>\n" +
|
||||
" <td class=\"goread\">\n" +
|
||||
"<a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>继续阅读</a>" +
|
||||
"<div style=''><a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>继续阅读</a></div>" +
|
||||
"<div style='line-height:8px;padding-bottom:13px'><a href='javascript:removeFromBookShelf(\"" + book.bookId + "\")'>移出书架</a></div>" +
|
||||
" </td>\n" +
|
||||
" </tr>");
|
||||
}
|
||||
@ -160,5 +161,21 @@
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function removeFromBookShelf(bookId) {
|
||||
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "/user/removeFromBookShelf/" + bookId,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
$("#shelf" + bookId).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
33
pom.xml
@ -5,7 +5,7 @@
|
||||
|
||||
<groupId>com.java2nb</groupId>
|
||||
<artifactId>novel</artifactId>
|
||||
<version>5.0.0</version>
|
||||
<version>5.1.0</version>
|
||||
<modules>
|
||||
<module>novel-common</module>
|
||||
<module>novel-front</module>
|
||||
@ -113,4 +113,35 @@
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<!-- 定义一个用于切换到中央仓库的profile -->
|
||||
<id>central-repo</id>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>central</id>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>central-plugin</id>
|
||||
<url>https://repo.maven.apache.org/maven2/</url>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
@ -8,6 +8,79 @@
|
||||
<title>作家管理系统-小说精品屋</title>
|
||||
<link rel="stylesheet" href="/css/base.css?v=1"/>
|
||||
<link rel="stylesheet" href="/css/user.css"/>
|
||||
<style>
|
||||
/* 编辑器容器样式 */
|
||||
.editor-container {
|
||||
margin: 10px 0px;
|
||||
padding: 20px;
|
||||
background: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1);
|
||||
}
|
||||
|
||||
/* 文本域样式 */
|
||||
#bookContent {
|
||||
width: 93%;
|
||||
height: 400px;
|
||||
padding: 15px;
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 4px;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
/* 工具栏样式 */
|
||||
.ai-toolbar {
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
gap: 10px; /* 按钮间距 */
|
||||
}
|
||||
|
||||
/* 自定义链接按钮样式 */
|
||||
.ai-link {
|
||||
display: inline-block;
|
||||
padding: 10px 20px;
|
||||
border-radius: 8px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
background: linear-gradient(135deg, #6a11cb, #2575fc);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 链接按钮悬停效果 */
|
||||
.ai-link:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
||||
}
|
||||
|
||||
/* 链接按钮点击效果 */
|
||||
.ai-link:active {
|
||||
transform: translateY(0);
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
/* 不同按钮的颜色 */
|
||||
.ai-link.expand {
|
||||
background: linear-gradient(135deg, #ff9a9e, #fad0c4);
|
||||
}
|
||||
|
||||
.ai-link.condense {
|
||||
background: linear-gradient(135deg, #a18cd1, #fbc2eb);
|
||||
}
|
||||
|
||||
.ai-link.continue {
|
||||
background: linear-gradient(135deg, #f6d365, #fda085);
|
||||
}
|
||||
|
||||
.ai-link.polish {
|
||||
background: linear-gradient(135deg, #ff6f61, #ffcc00);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
</head>
|
||||
<body class="">
|
||||
@ -46,18 +119,29 @@
|
||||
<ul class="log_list">
|
||||
<li><span id="LabErr"></span></li>
|
||||
<b>章节名:</b>
|
||||
<li><input type="text" id="bookIndex" name="bookIndex" class="s_input" ></li>
|
||||
<b>章节内容:</b><li id="contentLi">
|
||||
<textarea name="bookContent" rows="30" cols="80" id="bookContent"
|
||||
class="textarea"></textarea></li><br/>
|
||||
<li><input type="text" id="bookIndex" name="bookIndex" class="s_input"></li>
|
||||
<b>章节内容:</b>
|
||||
<li id="contentLi" style="width: 500px">
|
||||
<div class="editor-container">
|
||||
<div class="ai-toolbar">
|
||||
<a class="ai-link expand" data-type="stream/expand">AI扩写</a>
|
||||
<a class="ai-link condense" data-type="stream/condense">AI缩写</a>
|
||||
<a class="ai-link continue" data-type="stream/continue">AI续写</a>
|
||||
<a class="ai-link polish" data-type="stream/polish">AI润色</a>
|
||||
</div>
|
||||
<textarea id="bookContent" name="bookContent"
|
||||
placeholder="请输入文本内容..."></textarea>
|
||||
</div>
|
||||
|
||||
<b>是否收费:</b>
|
||||
<li><input type="radio" name="isVip" value="0" checked >免费
|
||||
<input type="radio" name="isVip" value="1" >收费</li>
|
||||
<b>是否收费:</b>
|
||||
<li><input type="radio" name="isVip" value="0" checked>免费
|
||||
<input type="radio" name="isVip" value="1">收费
|
||||
</li>
|
||||
|
||||
|
||||
<li style="margin-top: 10px"><input type="button" onclick="addBookContent()" name="btnRegister" value="提交"
|
||||
id="btnRegister" class="btn_red">
|
||||
<li style="margin-top: 10px"><input type="button" onclick="addBookContent()"
|
||||
name="btnRegister" value="提交"
|
||||
id="btnRegister" class="btn_red">
|
||||
|
||||
|
||||
</li>
|
||||
@ -113,9 +197,10 @@
|
||||
|
||||
|
||||
var lock = false;
|
||||
|
||||
function addBookContent() {
|
||||
|
||||
if(lock){
|
||||
if (lock) {
|
||||
return;
|
||||
}
|
||||
lock = true;
|
||||
@ -125,14 +210,14 @@
|
||||
|
||||
|
||||
var indexName = $("#bookIndex").val();
|
||||
if(!indexName){
|
||||
if (!indexName) {
|
||||
$("#LabErr").html("章节名不能为空!");
|
||||
lock = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var content = $("#bookContent").val();
|
||||
if(!content){
|
||||
if (!content) {
|
||||
$("#LabErr").html("章节内容不能为空!");
|
||||
lock = false;
|
||||
return;
|
||||
@ -142,17 +227,15 @@
|
||||
var isVip = $("input:checked[name=isVip]").val();
|
||||
|
||||
|
||||
|
||||
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "/author/addBookContent",
|
||||
data: {'bookId':bookId,'indexName':indexName,'content':content,'isVip':isVip},
|
||||
data: {'bookId': bookId, 'indexName': indexName, 'content': content, 'isVip': isVip},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
|
||||
window.location.href = '/author/index_list.html?bookId='+bookId;
|
||||
window.location.href = '/author/index_list.html?bookId=' + bookId;
|
||||
|
||||
|
||||
} else {
|
||||
@ -169,5 +252,116 @@
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 打字机效果函数
|
||||
function typeWriter(textarea, text, speed = 50) {
|
||||
let i = 0;
|
||||
const timer = setInterval(() => {
|
||||
if (i < text.length) {
|
||||
textarea.val(textarea.val() + text.charAt(i));
|
||||
i++;
|
||||
// 滚动到底部
|
||||
textarea.scrollTop(textarea[0].scrollHeight);
|
||||
} else {
|
||||
clearInterval(timer);
|
||||
}
|
||||
}, speed);
|
||||
}
|
||||
|
||||
$('.ai-toolbar .ai-link').click(function (e) {
|
||||
e.preventDefault(); // 阻止默认链接行为
|
||||
const type = $(this).data('type');
|
||||
const textarea = $('#bookContent');
|
||||
const selectedText = textarea.val().substring(textarea[0].selectionStart, textarea[0].selectionEnd);
|
||||
|
||||
// 检查是否选中文本
|
||||
if (!selectedText) {
|
||||
layer.msg('请先选中要处理的文本');
|
||||
return;
|
||||
}
|
||||
|
||||
const loading = layer.load(1, {shade: 0.3});
|
||||
|
||||
// 参数配置
|
||||
let params = {text: selectedText};
|
||||
if (type === 'stream/expand' || type === 'stream/condense') {
|
||||
layer.prompt({
|
||||
title: '请输入比例',
|
||||
value: 2,
|
||||
btn: ['确定', '取消'],
|
||||
btn2: function () {
|
||||
layer.close(loading);
|
||||
},
|
||||
cancel: function () {
|
||||
layer.close(loading);
|
||||
}
|
||||
}, function (value, index) {
|
||||
if (isNaN(Number(value)) || isNaN(parseFloat(value))) {
|
||||
layer.msg('请输入正确的比例');
|
||||
return;
|
||||
}
|
||||
if (type === 'stream/expand' && value <= 1) {
|
||||
layer.msg('请输入正确的比例');
|
||||
return;
|
||||
}
|
||||
if (type === 'stream/condense' && (value <= 0 || value >= 1)) {
|
||||
layer.msg('请输入正确的比例');
|
||||
return;
|
||||
}
|
||||
params.ratio = parseFloat(value) * 100;
|
||||
layer.close(index);
|
||||
sendRequest(type, params, loading, textarea);
|
||||
});
|
||||
return;
|
||||
} else if (type === 'stream/continue') {
|
||||
layer.prompt({
|
||||
title: '请输入续写长度(字数)',
|
||||
value: 200,
|
||||
btn: ['确定', '取消'],
|
||||
btn2: function () {
|
||||
layer.close(loading);
|
||||
},
|
||||
cancel: function () {
|
||||
layer.close(loading);
|
||||
}
|
||||
}, function (value, index) {
|
||||
if (!Number.isInteger(Number(value)) || value <= 0) {
|
||||
layer.msg('请输入正确的长度');
|
||||
return;
|
||||
}
|
||||
params.length = parseInt(value);
|
||||
layer.close(index);
|
||||
sendRequest(type, params, loading, textarea);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
sendRequest(type, params, loading, textarea);
|
||||
});
|
||||
|
||||
function sendRequest(type, params, loading, textarea) {
|
||||
const url = `/author/ai/${type}?text=${encodeURIComponent(params.text)}&ratio=${params.ratio}&length=${params.length}`;
|
||||
const eventSource = new EventSource(url);
|
||||
|
||||
// 监听消息事件
|
||||
eventSource.onmessage = function (event) {
|
||||
layer.close(loading);
|
||||
const data = event.data;
|
||||
console.log('Received data:', data);
|
||||
|
||||
textarea.val(textarea.val() + data);
|
||||
// 滚动到底部
|
||||
textarea.scrollTop(textarea[0].scrollHeight);
|
||||
};
|
||||
|
||||
// 监听错误事件
|
||||
eventSource.onerror = function (error) {
|
||||
layer.close(loading);
|
||||
console.error('EventSource failed:', error);
|
||||
eventSource.close(); // 关闭连接
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</html>
|
||||
|
@ -51,7 +51,8 @@
|
||||
</div>
|
||||
<div class="my_r">
|
||||
<div id="noContentDiv">
|
||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a></div>
|
||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="my_bookshelf" id="hasContentDiv" style="display: none">
|
||||
@ -142,10 +143,13 @@
|
||||
<script src="/javascript/common.js" type="text/javascript"></script>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
var searchCount = 0;
|
||||
var timeout;
|
||||
search(1, 5);
|
||||
|
||||
function search(curr, limit) {
|
||||
|
||||
searchCount++;
|
||||
clearTimeout(timeout);
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/author/listBookByPage",
|
||||
@ -155,6 +159,7 @@
|
||||
if (data.code == 200) {
|
||||
var bookList = data.data.list;
|
||||
if (bookList.length > 0) {
|
||||
var aiPicGenerating = bookList[0].picUrl == '/images/default.gif'
|
||||
$("#hasContentDiv").css("display", "block");
|
||||
$("#noContentDiv").css("display", "none");
|
||||
var bookListHtml = "";
|
||||
@ -226,6 +231,12 @@
|
||||
});
|
||||
});
|
||||
|
||||
if (curr === 1 && aiPicGenerating && searchCount < 10) {
|
||||
timeout = setTimeout(function () {
|
||||
search(curr, limit);
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<meta name="keywords" th:content="${application.website.name}+',小说,小说网,言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,原创网络文学'"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.name}+'每日更新小说连载,小说排行榜,提供言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,首发小说,最新章节免费小说阅读,精彩尽在'+${application.website.name}+'。'"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -7,8 +7,8 @@
|
||||
<meta name="keywords" th:content="${application.website.keyword}"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.description}"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -20,6 +20,22 @@
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
body {
|
||||
|
||||
-webkit-user-select: none; /* Chrome, Safari, Opera */
|
||||
|
||||
|
||||
-moz-user-select: none; /* Firefox */
|
||||
|
||||
|
||||
-ms-user-select: none; /* Internet Explorer/Edge */
|
||||
|
||||
|
||||
user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera, and Firefox */
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
.line-limit-length {
|
||||
|
||||
@ -62,11 +78,21 @@
|
||||
height: 180px;
|
||||
}
|
||||
|
||||
#tipLayer {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: rgba(255, 0, 0, 0.8);
|
||||
color: white;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
<input type="hidden" id="limit" th:value="${limit}"/>
|
||||
<input type="hidden" id="curr" th:value="${curr}"/>
|
||||
<input type="hidden" id="total" th:value="${total}"/>
|
||||
@ -95,6 +121,10 @@
|
||||
|
||||
|
||||
</div>
|
||||
<div id="tipLayer"
|
||||
style="display:none; position:absolute; background-color:rgba(255, 0, 0, 0.8); color:white; padding:5px; border-radius:3px; cursor:pointer;">
|
||||
移出书架
|
||||
</div>
|
||||
|
||||
|
||||
<div id="books" style="text-align: center;"></div>
|
||||
@ -105,11 +135,12 @@
|
||||
|
||||
<a name="buttom"></a>
|
||||
</body>
|
||||
|
||||
<div th:replace="mobile/common/js :: js"></div>
|
||||
|
||||
<script>
|
||||
|
||||
var timeout, isLongPress = false;
|
||||
|
||||
search(1, 20);
|
||||
|
||||
function search(curr, limit) {
|
||||
@ -136,22 +167,16 @@
|
||||
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
||||
}
|
||||
|
||||
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||
" <a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>\n" +
|
||||
bookListHtml += ("<div id='" + book.bookId + "' onclick='read(\"" + book.bookId + "\",\"" + book.preContentId + "\")' class=\"item layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||
" <div class=\"layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
|
||||
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
|
||||
" src=\"" + book.picUrl + "\"/>\n" +
|
||||
"\n" +
|
||||
" </div>\n" +
|
||||
" </a>\n" +
|
||||
" \n" +
|
||||
" <div style=\"padding: 10px\" class=\"layui-col-xs6 layui-col-sm8 layui-col-md8 layui-col-lg8\">\n" +
|
||||
" <a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>\n" +
|
||||
" <div class=\"line-limit-length\" style=\";color: #000;font-size: 15px\">" + book.bookName + "</div>\n" +
|
||||
" </a>\n" +
|
||||
" <div style=\";color: #4c6978;float: right;\"><i style=\"color: red\"></i></div>\n" +
|
||||
" <a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>\n" +
|
||||
" <div style=\";color: #a6a6a6;\" class=\"line-limit-length\">作者:" + book.authorName + "</div>\n" +
|
||||
" </a>\n" +
|
||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">类别:" + book.catName + "</div>\n" +
|
||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "</div>\n" +
|
||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">更新:<i style='color: red'>" + book.lastIndexUpdateTime.substr(0, 11) + "</i>\n" +
|
||||
@ -165,6 +190,41 @@
|
||||
}
|
||||
$("#bookList").html(bookListHtml);
|
||||
|
||||
|
||||
$(".item").on('touchstart', function (e) {
|
||||
var element = $(this);
|
||||
// 清除可能存在的定时器
|
||||
clearTimeout(timeout);
|
||||
isLongPress = false;
|
||||
|
||||
// 获取触摸点位置
|
||||
var touch = e.originalEvent.touches[0];
|
||||
|
||||
// 设置一个定时器,在500ms后触发(可以根据需要调整时间)
|
||||
timeout = setTimeout(function () {
|
||||
e.preventDefault();
|
||||
showTip(touch, element);
|
||||
}, 1000);
|
||||
}).on('touchend', function (e) {
|
||||
if (!isLongPress) {
|
||||
// 如果没有发生长按,则执行点击事件的逻辑
|
||||
clearTimeout(timeout);
|
||||
}
|
||||
}).on('touchmove', function () {
|
||||
clearTimeout(timeout);
|
||||
hideTip();
|
||||
}).on('contextmenu', function (e) {
|
||||
e.preventDefault();
|
||||
});
|
||||
|
||||
$('#tipLayer').click(function () {
|
||||
// 点击tips层时删除对应的.item元素
|
||||
removeFromBookShelf($(this).data('target').attr("id"));
|
||||
$(this).data('target').remove();
|
||||
hideTip();
|
||||
});
|
||||
|
||||
|
||||
layui.use('laypage', function () {
|
||||
var laypage = layui.laypage;
|
||||
|
||||
@ -203,6 +263,23 @@
|
||||
|
||||
}
|
||||
|
||||
function showTip(touchEvent, element) {
|
||||
isLongPress = true;
|
||||
// 根据触摸点位置设置弹出层的位置
|
||||
$('#tipLayer')
|
||||
.css({
|
||||
top: touchEvent.pageY - 100, // 调整这个值以改变弹出层相对于触摸点的位置
|
||||
left: touchEvent.pageX - ($('#tipLayer').outerWidth() / 2)
|
||||
})
|
||||
.data('target', element) // 存储目标元素以便后续操作
|
||||
.show();
|
||||
}
|
||||
|
||||
function hideTip() {
|
||||
isLongPress = false;
|
||||
$('#tipLayer').hide().removeData('target'); // 隐藏tips并清除数据
|
||||
}
|
||||
|
||||
|
||||
function searchByAllCondition(curr, limit, newKeyword) {
|
||||
var toUrl = "/book/search?curr=" + curr + "&limit=" + limit;
|
||||
@ -248,18 +325,35 @@
|
||||
searchByAllCondition(1, 20, keywords);
|
||||
}
|
||||
|
||||
function read(bookId, contentId) {
|
||||
if (isLongPress) {
|
||||
return false;
|
||||
}
|
||||
location.href = '/book/' + bookId + "/" + contentId + ".html"
|
||||
hideTip();
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
|
||||
|
||||
function toMyCollect() {
|
||||
var token = localStorage.getItem("token");
|
||||
if (token) {
|
||||
window.location.href = "/book/search?token=" + token;
|
||||
} else {
|
||||
window.location.href = "/user/login.html";
|
||||
}
|
||||
function removeFromBookShelf(bookId) {
|
||||
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "/user/removeFromBookShelf/" + bookId,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
$("#shelf" + bookId).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
@ -53,7 +53,7 @@
|
||||
更新时间
|
||||
</th>
|
||||
<th class="goread">
|
||||
书签
|
||||
操作
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -94,7 +94,7 @@
|
||||
var bookShelfListHtml = "";
|
||||
for (var i = 0; i < bookShelfList.length; i++) {
|
||||
var book = bookShelfList[i];
|
||||
bookShelfListHtml += (" <tr class=\"book_list\" vals=\"291\">\n" +
|
||||
bookShelfListHtml += (" <tr id='shelf" + book.bookId + "' class=\"book_list\" vals=\"291\">\n" +
|
||||
" <td class=\"style bookclass\">\n" +
|
||||
" <a href=\"/book/bookclass.html?c=" + book.catId + "\" >[" + book.catName + "]</a>\n" +
|
||||
" </td>\n" +
|
||||
@ -109,7 +109,8 @@
|
||||
" " + book.lastIndexUpdateTime + "\n" +
|
||||
" </td>\n" +
|
||||
" <td class=\"goread\">\n" +
|
||||
"<a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>继续阅读</a>" +
|
||||
"<div style=''><a href='/book/" + book.bookId + "/" + book.preContentId + ".html'>继续阅读</a></div>" +
|
||||
"<div style='line-height:8px;padding-bottom:13px'><a href='javascript:removeFromBookShelf(\"" + book.bookId + "\")'>移出书架</a></div>" +
|
||||
" </td>\n" +
|
||||
" </tr>");
|
||||
}
|
||||
@ -160,5 +161,21 @@
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
function removeFromBookShelf(bookId) {
|
||||
|
||||
$.ajax({
|
||||
type: "delete",
|
||||
url: "/user/removeFromBookShelf/" + bookId,
|
||||
data: {},
|
||||
dataType: "json",
|
||||
success: function (data) {
|
||||
if (data.code == 200) {
|
||||
$("#shelf" + bookId).remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
</script>
|
||||
</html>
|
||||
|
BIN
templates/green/static/favicon.ico
Normal file
After Width: | Height: | Size: 162 KiB |
@ -6,8 +6,8 @@
|
||||
<meta name="keywords" th:content="${application.website.name}+',小说,小说网,言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,原创网络文学'"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.name}+'每日更新小说连载,小说排行榜,提供言情小说,都市小说,玄幻小说,穿越小说,青春小说,总裁豪门小说,网络小说,免费小说,全本小说,首发小说,最新章节免费小说阅读,精彩尽在'+${application.website.name}+'。'"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -7,8 +7,8 @@
|
||||
<meta name="keywords" th:content="${application.website.keyword}"/>
|
||||
<meta name="description"
|
||||
th:content="${application.website.description}"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="shortcut icon"/>
|
||||
<link href="/favicon.ico" type="image/x-icon" rel="Bookmark"/>
|
||||
<link rel="stylesheet" href="/css/main.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|