mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-15 13:46:39 +00:00
Compare commits
22 Commits
Author | SHA1 | Date | |
---|---|---|---|
720711414c | |||
522bb7c739 | |||
64e1686fd1 | |||
90009a57f4 | |||
6452c1603f | |||
d54eda2366 | |||
972a49f1ba | |||
675b156094 | |||
3c409023e5 | |||
02fb819120 | |||
8c572edb10 | |||
8c9013ad05 | |||
4693c7ffae | |||
efb136e3be | |||
7955db0e3c | |||
60dc28c5ed | |||
1534220f0c | |||
0830f6ffeb | |||
adc83db64e | |||
9c11f22816 | |||
24abe7714f | |||
a9fc80eba1 |
15
README.md
15
README.md
@ -9,7 +9,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
👉 <a href='https://novel.xxyopen.com'>官网</a> | 👉 <a href='https://www.bilibili.com/video/BV1Zo4y187Mi'>项目演示</a> | 👉 <a href='https://docs.xxyopen.com/course/novelplus/1.html'>安装教程</a>
|
👉 <a href='https://novel.xxyopen.com'>官网</a> | 👉 <a href='http://117.72.165.13:8888'>演示站点</a> | 👉 <a href='https://docs.xxyopen.com/course/novelplus/1.html'>安装教程</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
## 项目介绍
|
## 项目介绍
|
||||||
@ -21,8 +21,8 @@ TXT 文本存储)、阅读主题切换、多爬虫源自动采集和更新数
|
|||||||
## 项目地址
|
## 项目地址
|
||||||
|
|
||||||
- 学习版:[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
- 学习版:[GitHub](https://github.com/201206030/novel) | [码云](https://gitee.com/novel_dev_team/novel)
|
||||||
| [保姆级教程](https://docs.xxyopen.com)
|
| [保姆级教程](https://docs.xxyopen.com)
|
||||||
- **应用版**:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus)
|
- **应用版**:[GitHub](https://github.com/201206030/novel-plus) | [码云](https://gitee.com/novel_dev_team/novel-plus) | [演示站点](http://117.72.165.13:8888)
|
||||||
- 微服务版:[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
- 微服务版:[GitHub](https://github.com/201206030/novel-cloud) | [码云](https://gitee.com/novel_dev_team/novel-cloud)
|
||||||
|
|
||||||
## 项目结构
|
## 项目结构
|
||||||
@ -77,14 +77,11 @@ novel-plus 5.x 已集成 Spring 官方最新发布的 Spring AI 框架,并推
|
|||||||
1. v5.0.0 版本在小说章节发布页面的文本编辑器中集成了多项智能编辑功能,包括 AI 扩写、缩写、续写及文本润色等。这些功能的设计灵感来源于百家号文章编辑器中的 AI 助手。
|
1. v5.0.0 版本在小说章节发布页面的文本编辑器中集成了多项智能编辑功能,包括 AI 扩写、缩写、续写及文本润色等。这些功能的设计灵感来源于百家号文章编辑器中的 AI 助手。
|
||||||
2. v5.1.0 版本在小说发布页面,新增 AI 生成封面图功能。若作家未上传自定义封面图,系统将根据小说信息自动生成封面图。
|
2. v5.1.0 版本在小说发布页面,新增 AI 生成封面图功能。若作家未上传自定义封面图,系统将根据小说信息自动生成封面图。
|
||||||
|
|
||||||
目前,AI 功能仍处于实验阶段,仅实现了基础的核心功能。我们非常重视用户的实际使用体验和反馈,未来将根据用户需求和使用情况,持续优化和调整该功能。如果用户反馈积极,我们计划进一步开发更高级的
|
目前,AI 功能仍处于实验阶段,仅实现了基础的核心功能。我们非常重视用户的实际使用体验和反馈,未来将根据用户需求和使用情况,持续优化和调整该功能。如果用户反馈积极,我们计划进一步开发更高级的 AI 功能,例如自动生成有声小说、智能情节推荐等,以全面提升 novel-plus 的创作能力和用户体验。
|
||||||
AI 功能,例如自动生成有声小说、智能情节推荐等,以全面提升 novel-plus 的创作能力和用户体验。
|
|
||||||
|
|
||||||
我们将持续关注 AI 技术的发展,并致力于将其与小说创作场景深度融合,为用户带来更智能、更便捷的创作工具。
|
我们将持续关注 AI 技术的发展,并致力于将其与小说创作场景深度融合,为用户带来更智能、更便捷的创作工具。
|
||||||
|
|
||||||
由于 DeepSeek 官方 API 目前不可用,novel-plus 项目默认使用的是第三方[硅基流动](https://cloud.siliconflow.cn/i/DOgMRH9S)
|
novel-plus 项目默认使用的是第三方大模型服务平台[硅基流动](https://cloud.siliconflow.cn/i/DOgMRH9S)提供的 API(兼容 OpenAI 的相关接口,可直接通过 Spring AI 框架调用),采用的 AI 模型有对话模型`deepseek-ai/DeepSeek-R1-Distill-Llama-8B`(DeepSeek-R1 的蒸馏版本,免费使用)和生图模型`Kwai-Kolors/Kolors`(快手 Kolors 团队开发的文本到图像生成模型,免费使用)。只需注册一个硅基流动账号,创建一个 API 密钥,并将其添加到 novel-plus 项目 novel-front 模块的 yaml 配置文件中,即可体验 novel-plus 项目的 AI 写作功能。
|
||||||
提供的 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
|
```yaml
|
||||||
spring:
|
spring:
|
||||||
@ -104,7 +101,7 @@ spring:
|
|||||||
model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
|
model: deepseek-ai/DeepSeek-R1-Distill-Llama-8B
|
||||||
```
|
```
|
||||||
|
|
||||||
> ⚠️ novel-plus 项目默认使用的都是免费 AI 模型,生成效果有限。如果对生成内容有更高的要求,建议选用付费的 AI 模型。
|
⚠️ novel-plus 项目默认使用的都是免费 AI 模型,生成效果有限。如果对生成内容有更高的要求,建议选用付费的 AI 模型。
|
||||||
|
|
||||||
## 增值服务
|
## 增值服务
|
||||||
|
|
||||||
|
3
doc/sql/20250630.sql
Normal file
3
doc/sql/20250630.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
alter table book_comment add column location varchar(50) DEFAULT NULL COMMENT '地理位置' after comment_content ;
|
||||||
|
|
||||||
|
|
3
doc/sql/20250711.sql
Normal file
3
doc/sql/20250711.sql
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
alter table crawl_single_task add column crawl_chapters int DEFAULT 0 COMMENT '采集章节数量' after exc_count ;
|
||||||
|
|
||||||
|
|
13
doc/sql/20250712.sql
Normal file
13
doc/sql/20250712.sql
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
DROP TABLE IF EXISTS `book_comment_reply`;
|
||||||
|
CREATE TABLE `book_comment_reply`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`comment_id` bigint(20) DEFAULT NULL COMMENT '评论ID',
|
||||||
|
`reply_content` varchar(512) DEFAULT NULL COMMENT '回复内容',
|
||||||
|
`location` varchar(50) DEFAULT NULL COMMENT '地理位置',
|
||||||
|
`audit_status` tinyint(1) DEFAULT '0' COMMENT '审核状态,0:待审核,1:审核通过,2:审核不通过',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '回复用户ID',
|
||||||
|
`create_user_id` bigint(20) DEFAULT NULL COMMENT '回复时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='小说评论回复表';
|
@ -3153,4 +3153,25 @@ where menu_id = 104;
|
|||||||
|
|
||||||
delete
|
delete
|
||||||
from sys_menu
|
from sys_menu
|
||||||
where menu_id = 57;
|
where menu_id = 57;
|
||||||
|
|
||||||
|
|
||||||
|
alter table book_comment add column location varchar(50) DEFAULT NULL COMMENT '地理位置' after comment_content ;
|
||||||
|
|
||||||
|
|
||||||
|
alter table crawl_single_task add column crawl_chapters int DEFAULT 0 COMMENT '采集章节数量' after exc_count ;
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `book_comment_reply`;
|
||||||
|
CREATE TABLE `book_comment_reply`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`comment_id` bigint(20) DEFAULT NULL COMMENT '评论ID',
|
||||||
|
`reply_content` varchar(512) DEFAULT NULL COMMENT '回复内容',
|
||||||
|
`location` varchar(50) DEFAULT NULL COMMENT '地理位置',
|
||||||
|
`audit_status` tinyint(1) DEFAULT '0' COMMENT '审核状态,0:待审核,1:审核通过,2:审核不通过',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '回复用户ID',
|
||||||
|
`create_user_id` bigint(20) DEFAULT NULL COMMENT '回复时间',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='小说评论回复表';
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel-admin</artifactId>
|
<artifactId>novel-admin</artifactId>
|
||||||
<version>5.1.3</version>
|
<version>5.2.1</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>novel-admin</name>
|
<name>novel-admin</name>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>后台管理-登陆</title>
|
<title>后台管理-登录</title>
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
|
||||||
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
<meta http-equiv="Access-Control-Allow-Origin" content="*">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.1.3</version>
|
<version>5.2.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public enum ResponseStatus implements IResultCode {
|
|||||||
/**
|
/**
|
||||||
* 用户相关错误
|
* 用户相关错误
|
||||||
* */
|
* */
|
||||||
NO_LOGIN(1001, "未登录或登陆失效!"),
|
NO_LOGIN(1001, "未登录或登录失效!"),
|
||||||
VEL_CODE_ERROR(1002, "验证码错误!"),
|
VEL_CODE_ERROR(1002, "验证码错误!"),
|
||||||
USERNAME_EXIST(1003,"该手机号已注册!"),
|
USERNAME_EXIST(1003,"该手机号已注册!"),
|
||||||
USERNAME_PASS_ERROR(1004,"手机号或密码错误!"),
|
USERNAME_PASS_ERROR(1004,"手机号或密码错误!"),
|
||||||
|
@ -106,6 +106,47 @@ public class DateUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 将日期格式化成"多久之前"的格式
|
||||||
|
* */
|
||||||
|
public static String formatTimeAgo(Date date){
|
||||||
|
if (date == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
long now = new Date().getTime();
|
||||||
|
long then = date.getTime();
|
||||||
|
|
||||||
|
long diff = now - then;
|
||||||
|
|
||||||
|
if (diff < 0) {
|
||||||
|
// 未来时间
|
||||||
|
DateUtil.formatDate(date, DateUtil.DATE_TIME_PATTERN);
|
||||||
|
}
|
||||||
|
|
||||||
|
long seconds = diff / 1000;
|
||||||
|
long minutes = seconds / 60;
|
||||||
|
long hours = minutes / 60;
|
||||||
|
long days = hours / 24;
|
||||||
|
long months = days / 30;
|
||||||
|
long years = months / 12;
|
||||||
|
|
||||||
|
if (seconds < 60) {
|
||||||
|
return "刚刚";
|
||||||
|
} else if (minutes < 60) {
|
||||||
|
return minutes + "分钟前";
|
||||||
|
} else if (hours < 24) {
|
||||||
|
return hours + "小时前";
|
||||||
|
} else if (days < 30) {
|
||||||
|
return days + "天前";
|
||||||
|
} else if (months < 12) {
|
||||||
|
return months + "个月前";
|
||||||
|
} else {
|
||||||
|
return years + "年前";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println(formatDate(getYesterday(),DATE_TIME_PATTERN));
|
System.out.println(formatDate(getYesterday(),DATE_TIME_PATTERN));
|
||||||
System.out.println(formatDate(getDateStartTime(getYesterday()),DATE_TIME_PATTERN));
|
System.out.println(formatDate(getDateStartTime(getYesterday()),DATE_TIME_PATTERN));
|
||||||
|
@ -5,8 +5,8 @@ import org.springframework.http.*;
|
|||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Administrator
|
* @author Administrator
|
||||||
@ -16,7 +16,7 @@ public class HttpUtil {
|
|||||||
|
|
||||||
private static final String DEFAULT_CHARSET = "utf-8";
|
private static final String DEFAULT_CHARSET = "utf-8";
|
||||||
|
|
||||||
private static final Map<String, RestTemplate> REST_TEMPLATE_MAP = new HashMap<>();
|
private static final Map<String, RestTemplate> REST_TEMPLATE_MAP = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static String getByHttpClientWithChrome(String url, String charset) {
|
public static String getByHttpClientWithChrome(String url, String charset) {
|
||||||
log.debug("Get url:{}", url);
|
log.debug("Get url:{}", url);
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
package com.java2nb.novel.core.utils;
|
package com.java2nb.novel.core.utils;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.http.HttpClient;
|
||||||
|
import java.net.http.HttpRequest;
|
||||||
|
import java.net.http.HttpResponse;
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
public class IpUtil {
|
public class IpUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取真实IP
|
* 获取真实IP
|
||||||
|
*
|
||||||
* @param request 请求体
|
* @param request 请求体
|
||||||
* @return 真实IP
|
* @return 真实IP
|
||||||
*/
|
*/
|
||||||
@ -31,4 +41,27 @@ public class IpUtil {
|
|||||||
}
|
}
|
||||||
return ip;
|
return ip;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取本机公网IP
|
||||||
|
*/
|
||||||
|
public static String getPublicIP() {
|
||||||
|
try {
|
||||||
|
HttpClient client = HttpClient.newHttpClient();
|
||||||
|
HttpRequest request = HttpRequest.newBuilder()
|
||||||
|
.uri(URI.create("https://httpbin.org/ip"))
|
||||||
|
.GET()
|
||||||
|
.timeout(Duration.ofSeconds(5))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
|
||||||
|
|
||||||
|
if (response.statusCode() == 200) {
|
||||||
|
return new ObjectMapper().readTree(response.body()).get("origin").asText();
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("获取本机公网IP异常", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,9 @@ public class BookComment {
|
|||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private String commentContent;
|
private String commentContent;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private String location;
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Integer replyCount;
|
private Integer replyCount;
|
||||||
|
|
||||||
@ -56,6 +59,16 @@ public class BookComment {
|
|||||||
this.commentContent = commentContent == null ? null : commentContent.trim();
|
this.commentContent = commentContent == null ? null : commentContent.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setLocation(String location) {
|
||||||
|
this.location = location == null ? null : location.trim();
|
||||||
|
}
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
public Integer getReplyCount() {
|
public Integer getReplyCount() {
|
||||||
return replyCount;
|
return replyCount;
|
||||||
|
@ -0,0 +1,97 @@
|
|||||||
|
package com.java2nb.novel.entity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
|
||||||
|
public class BookCommentReply {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long commentId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private String replyContent;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private String location;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Byte auditStatus;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Long createUserId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getCommentId() {
|
||||||
|
return commentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setCommentId(Long commentId) {
|
||||||
|
this.commentId = commentId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public String getReplyContent() {
|
||||||
|
return replyContent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setReplyContent(String replyContent) {
|
||||||
|
this.replyContent = replyContent == null ? null : replyContent.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public String getLocation() {
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setLocation(String location) {
|
||||||
|
this.location = location == null ? null : location.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Byte getAuditStatus() {
|
||||||
|
return auditStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setAuditStatus(Byte auditStatus) {
|
||||||
|
this.auditStatus = auditStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Long getCreateUserId() {
|
||||||
|
return createUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setCreateUserId(Long createUserId) {
|
||||||
|
this.createUserId = createUserId;
|
||||||
|
}
|
||||||
|
}
|
@ -31,6 +31,9 @@ public class CrawlSingleTask {
|
|||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Byte excCount;
|
private Byte excCount;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
private Integer crawlChapters;
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@ -124,6 +127,16 @@ public class CrawlSingleTask {
|
|||||||
this.excCount = excCount;
|
this.excCount = excCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public Integer getCrawlChapters() {
|
||||||
|
return crawlChapters;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public void setCrawlChapters(Integer crawlChapters) {
|
||||||
|
this.crawlChapters = crawlChapters;
|
||||||
|
}
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
public Date getCreateTime() {
|
public Date getCreateTime() {
|
||||||
return createTime;
|
return createTime;
|
||||||
|
@ -19,6 +19,9 @@ public final class BookCommentDynamicSqlSupport {
|
|||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
public static final SqlColumn<String> commentContent = bookComment.commentContent;
|
public static final SqlColumn<String> commentContent = bookComment.commentContent;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<String> location = bookComment.location;
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
public static final SqlColumn<Integer> replyCount = bookComment.replyCount;
|
public static final SqlColumn<Integer> replyCount = bookComment.replyCount;
|
||||||
|
|
||||||
@ -39,6 +42,8 @@ public final class BookCommentDynamicSqlSupport {
|
|||||||
|
|
||||||
public final SqlColumn<String> commentContent = column("comment_content", JDBCType.VARCHAR);
|
public final SqlColumn<String> commentContent = column("comment_content", JDBCType.VARCHAR);
|
||||||
|
|
||||||
|
public final SqlColumn<String> location = column("location", JDBCType.VARCHAR);
|
||||||
|
|
||||||
public final SqlColumn<Integer> replyCount = column("reply_count", JDBCType.INTEGER);
|
public final SqlColumn<Integer> replyCount = column("reply_count", JDBCType.INTEGER);
|
||||||
|
|
||||||
public final SqlColumn<Byte> auditStatus = column("audit_status", JDBCType.TINYINT);
|
public final SqlColumn<Byte> auditStatus = column("audit_status", JDBCType.TINYINT);
|
||||||
|
@ -29,7 +29,7 @@ import static org.mybatis.dynamic.sql.SqlBuilder.isEqualTo;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface BookCommentMapper {
|
public interface BookCommentMapper {
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
BasicColumn[] selectList = BasicColumn.columnList(id, bookId, commentContent, replyCount, auditStatus, createTime, createUserId);
|
BasicColumn[] selectList = BasicColumn.columnList(id, bookId, commentContent, location, replyCount, auditStatus, createTime, createUserId);
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
@ -58,6 +58,7 @@ public interface BookCommentMapper {
|
|||||||
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||||
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
@Result(column="book_id", property="bookId", jdbcType=JdbcType.BIGINT),
|
||||||
@Result(column="comment_content", property="commentContent", jdbcType=JdbcType.VARCHAR),
|
@Result(column="comment_content", property="commentContent", jdbcType=JdbcType.VARCHAR),
|
||||||
|
@Result(column="location", property="location", jdbcType=JdbcType.VARCHAR),
|
||||||
@Result(column="reply_count", property="replyCount", jdbcType=JdbcType.INTEGER),
|
@Result(column="reply_count", property="replyCount", jdbcType=JdbcType.INTEGER),
|
||||||
@Result(column="audit_status", property="auditStatus", jdbcType=JdbcType.TINYINT),
|
@Result(column="audit_status", property="auditStatus", jdbcType=JdbcType.TINYINT),
|
||||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||||
@ -92,6 +93,7 @@ public interface BookCommentMapper {
|
|||||||
c.map(id).toProperty("id")
|
c.map(id).toProperty("id")
|
||||||
.map(bookId).toProperty("bookId")
|
.map(bookId).toProperty("bookId")
|
||||||
.map(commentContent).toProperty("commentContent")
|
.map(commentContent).toProperty("commentContent")
|
||||||
|
.map(location).toProperty("location")
|
||||||
.map(replyCount).toProperty("replyCount")
|
.map(replyCount).toProperty("replyCount")
|
||||||
.map(auditStatus).toProperty("auditStatus")
|
.map(auditStatus).toProperty("auditStatus")
|
||||||
.map(createTime).toProperty("createTime")
|
.map(createTime).toProperty("createTime")
|
||||||
@ -105,6 +107,7 @@ public interface BookCommentMapper {
|
|||||||
c.map(id).toProperty("id")
|
c.map(id).toProperty("id")
|
||||||
.map(bookId).toProperty("bookId")
|
.map(bookId).toProperty("bookId")
|
||||||
.map(commentContent).toProperty("commentContent")
|
.map(commentContent).toProperty("commentContent")
|
||||||
|
.map(location).toProperty("location")
|
||||||
.map(replyCount).toProperty("replyCount")
|
.map(replyCount).toProperty("replyCount")
|
||||||
.map(auditStatus).toProperty("auditStatus")
|
.map(auditStatus).toProperty("auditStatus")
|
||||||
.map(createTime).toProperty("createTime")
|
.map(createTime).toProperty("createTime")
|
||||||
@ -118,6 +121,7 @@ public interface BookCommentMapper {
|
|||||||
c.map(id).toPropertyWhenPresent("id", record::getId)
|
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||||
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
.map(bookId).toPropertyWhenPresent("bookId", record::getBookId)
|
||||||
.map(commentContent).toPropertyWhenPresent("commentContent", record::getCommentContent)
|
.map(commentContent).toPropertyWhenPresent("commentContent", record::getCommentContent)
|
||||||
|
.map(location).toPropertyWhenPresent("location", record::getLocation)
|
||||||
.map(replyCount).toPropertyWhenPresent("replyCount", record::getReplyCount)
|
.map(replyCount).toPropertyWhenPresent("replyCount", record::getReplyCount)
|
||||||
.map(auditStatus).toPropertyWhenPresent("auditStatus", record::getAuditStatus)
|
.map(auditStatus).toPropertyWhenPresent("auditStatus", record::getAuditStatus)
|
||||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||||
@ -157,6 +161,7 @@ public interface BookCommentMapper {
|
|||||||
return dsl.set(id).equalTo(record::getId)
|
return dsl.set(id).equalTo(record::getId)
|
||||||
.set(bookId).equalTo(record::getBookId)
|
.set(bookId).equalTo(record::getBookId)
|
||||||
.set(commentContent).equalTo(record::getCommentContent)
|
.set(commentContent).equalTo(record::getCommentContent)
|
||||||
|
.set(location).equalTo(record::getLocation)
|
||||||
.set(replyCount).equalTo(record::getReplyCount)
|
.set(replyCount).equalTo(record::getReplyCount)
|
||||||
.set(auditStatus).equalTo(record::getAuditStatus)
|
.set(auditStatus).equalTo(record::getAuditStatus)
|
||||||
.set(createTime).equalTo(record::getCreateTime)
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
@ -168,6 +173,7 @@ public interface BookCommentMapper {
|
|||||||
return dsl.set(id).equalToWhenPresent(record::getId)
|
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||||
.set(bookId).equalToWhenPresent(record::getBookId)
|
.set(bookId).equalToWhenPresent(record::getBookId)
|
||||||
.set(commentContent).equalToWhenPresent(record::getCommentContent)
|
.set(commentContent).equalToWhenPresent(record::getCommentContent)
|
||||||
|
.set(location).equalToWhenPresent(record::getLocation)
|
||||||
.set(replyCount).equalToWhenPresent(record::getReplyCount)
|
.set(replyCount).equalToWhenPresent(record::getReplyCount)
|
||||||
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
|
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
|
||||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
@ -179,6 +185,7 @@ public interface BookCommentMapper {
|
|||||||
return update(c ->
|
return update(c ->
|
||||||
c.set(bookId).equalTo(record::getBookId)
|
c.set(bookId).equalTo(record::getBookId)
|
||||||
.set(commentContent).equalTo(record::getCommentContent)
|
.set(commentContent).equalTo(record::getCommentContent)
|
||||||
|
.set(location).equalTo(record::getLocation)
|
||||||
.set(replyCount).equalTo(record::getReplyCount)
|
.set(replyCount).equalTo(record::getReplyCount)
|
||||||
.set(auditStatus).equalTo(record::getAuditStatus)
|
.set(auditStatus).equalTo(record::getAuditStatus)
|
||||||
.set(createTime).equalTo(record::getCreateTime)
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
@ -192,6 +199,7 @@ public interface BookCommentMapper {
|
|||||||
return update(c ->
|
return update(c ->
|
||||||
c.set(bookId).equalToWhenPresent(record::getBookId)
|
c.set(bookId).equalToWhenPresent(record::getBookId)
|
||||||
.set(commentContent).equalToWhenPresent(record::getCommentContent)
|
.set(commentContent).equalToWhenPresent(record::getCommentContent)
|
||||||
|
.set(location).equalToWhenPresent(record::getLocation)
|
||||||
.set(replyCount).equalToWhenPresent(record::getReplyCount)
|
.set(replyCount).equalToWhenPresent(record::getReplyCount)
|
||||||
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
|
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
|
||||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
|
@ -0,0 +1,54 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import java.sql.JDBCType;
|
||||||
|
import java.util.Date;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
import org.mybatis.dynamic.sql.SqlColumn;
|
||||||
|
import org.mybatis.dynamic.sql.SqlTable;
|
||||||
|
|
||||||
|
public final class BookCommentReplyDynamicSqlSupport {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final BookCommentReply bookCommentReply = new BookCommentReply();
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> id = bookCommentReply.id;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> commentId = bookCommentReply.commentId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<String> replyContent = bookCommentReply.replyContent;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<String> location = bookCommentReply.location;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Byte> auditStatus = bookCommentReply.auditStatus;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Date> createTime = bookCommentReply.createTime;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Long> createUserId = bookCommentReply.createUserId;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final class BookCommentReply extends SqlTable {
|
||||||
|
public final SqlColumn<Long> id = column("id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> commentId = column("comment_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public final SqlColumn<String> replyContent = column("reply_content", JDBCType.VARCHAR);
|
||||||
|
|
||||||
|
public final SqlColumn<String> location = column("location", JDBCType.VARCHAR);
|
||||||
|
|
||||||
|
public final SqlColumn<Byte> auditStatus = column("audit_status", JDBCType.TINYINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||||
|
|
||||||
|
public final SqlColumn<Long> createUserId = column("create_user_id", JDBCType.BIGINT);
|
||||||
|
|
||||||
|
public BookCommentReply() {
|
||||||
|
super("book_comment_reply");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,208 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import static com.java2nb.novel.mapper.BookCommentReplyDynamicSqlSupport.*;
|
||||||
|
import static org.mybatis.dynamic.sql.SqlBuilder.*;
|
||||||
|
|
||||||
|
import com.java2nb.novel.entity.BookCommentReply;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
import javax.annotation.Generated;
|
||||||
|
import org.apache.ibatis.annotations.DeleteProvider;
|
||||||
|
import org.apache.ibatis.annotations.InsertProvider;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Result;
|
||||||
|
import org.apache.ibatis.annotations.ResultMap;
|
||||||
|
import org.apache.ibatis.annotations.Results;
|
||||||
|
import org.apache.ibatis.annotations.SelectProvider;
|
||||||
|
import org.apache.ibatis.annotations.UpdateProvider;
|
||||||
|
import org.apache.ibatis.type.JdbcType;
|
||||||
|
import org.mybatis.dynamic.sql.BasicColumn;
|
||||||
|
import org.mybatis.dynamic.sql.delete.DeleteDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.delete.render.DeleteStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.insert.render.InsertStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.insert.render.MultiRowInsertStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.select.CountDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.select.SelectDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.select.render.SelectStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateDSL;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateDSLCompleter;
|
||||||
|
import org.mybatis.dynamic.sql.update.UpdateModel;
|
||||||
|
import org.mybatis.dynamic.sql.update.render.UpdateStatementProvider;
|
||||||
|
import org.mybatis.dynamic.sql.util.SqlProviderAdapter;
|
||||||
|
import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface BookCommentReplyMapper {
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
BasicColumn[] selectList = BasicColumn.columnList(id, commentId, replyContent, location, auditStatus, createTime, createUserId);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
long count(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@DeleteProvider(type=SqlProviderAdapter.class, method="delete")
|
||||||
|
int delete(DeleteStatementProvider deleteStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@InsertProvider(type=SqlProviderAdapter.class, method="insert")
|
||||||
|
int insert(InsertStatementProvider<BookCommentReply> insertStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@InsertProvider(type=SqlProviderAdapter.class, method="insertMultiple")
|
||||||
|
int insertMultiple(MultiRowInsertStatementProvider<BookCommentReply> multipleInsertStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@ResultMap("BookCommentReplyResult")
|
||||||
|
Optional<BookCommentReply> selectOne(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
|
@Results(id="BookCommentReplyResult", value = {
|
||||||
|
@Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
|
||||||
|
@Result(column="comment_id", property="commentId", jdbcType=JdbcType.BIGINT),
|
||||||
|
@Result(column="reply_content", property="replyContent", jdbcType=JdbcType.VARCHAR),
|
||||||
|
@Result(column="location", property="location", jdbcType=JdbcType.VARCHAR),
|
||||||
|
@Result(column="audit_status", property="auditStatus", jdbcType=JdbcType.TINYINT),
|
||||||
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
|
||||||
|
@Result(column="create_user_id", property="createUserId", jdbcType=JdbcType.BIGINT)
|
||||||
|
})
|
||||||
|
List<BookCommentReply> selectMany(SelectStatementProvider selectStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
@UpdateProvider(type=SqlProviderAdapter.class, method="update")
|
||||||
|
int update(UpdateStatementProvider updateStatement);
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default long count(CountDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.countFrom(this::count, bookCommentReply, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int delete(DeleteDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.deleteFrom(this::delete, bookCommentReply, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int deleteByPrimaryKey(Long id_) {
|
||||||
|
return delete(c ->
|
||||||
|
c.where(id, isEqualTo(id_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insert(BookCommentReply record) {
|
||||||
|
return MyBatis3Utils.insert(this::insert, record, bookCommentReply, c ->
|
||||||
|
c.map(id).toProperty("id")
|
||||||
|
.map(commentId).toProperty("commentId")
|
||||||
|
.map(replyContent).toProperty("replyContent")
|
||||||
|
.map(location).toProperty("location")
|
||||||
|
.map(auditStatus).toProperty("auditStatus")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
|
.map(createUserId).toProperty("createUserId")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insertMultiple(Collection<BookCommentReply> records) {
|
||||||
|
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, bookCommentReply, c ->
|
||||||
|
c.map(id).toProperty("id")
|
||||||
|
.map(commentId).toProperty("commentId")
|
||||||
|
.map(replyContent).toProperty("replyContent")
|
||||||
|
.map(location).toProperty("location")
|
||||||
|
.map(auditStatus).toProperty("auditStatus")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
|
.map(createUserId).toProperty("createUserId")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int insertSelective(BookCommentReply record) {
|
||||||
|
return MyBatis3Utils.insert(this::insert, record, bookCommentReply, c ->
|
||||||
|
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||||
|
.map(commentId).toPropertyWhenPresent("commentId", record::getCommentId)
|
||||||
|
.map(replyContent).toPropertyWhenPresent("replyContent", record::getReplyContent)
|
||||||
|
.map(location).toPropertyWhenPresent("location", record::getLocation)
|
||||||
|
.map(auditStatus).toPropertyWhenPresent("auditStatus", record::getAuditStatus)
|
||||||
|
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||||
|
.map(createUserId).toPropertyWhenPresent("createUserId", record::getCreateUserId)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default Optional<BookCommentReply> selectOne(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectOne(this::selectOne, selectList, bookCommentReply, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default List<BookCommentReply> select(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectList(this::selectMany, selectList, bookCommentReply, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default List<BookCommentReply> selectDistinct(SelectDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.selectDistinct(this::selectMany, selectList, bookCommentReply, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default Optional<BookCommentReply> selectByPrimaryKey(Long id_) {
|
||||||
|
return selectOne(c ->
|
||||||
|
c.where(id, isEqualTo(id_))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int update(UpdateDSLCompleter completer) {
|
||||||
|
return MyBatis3Utils.update(this::update, bookCommentReply, completer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
static UpdateDSL<UpdateModel> updateAllColumns(BookCommentReply record, UpdateDSL<UpdateModel> dsl) {
|
||||||
|
return dsl.set(id).equalTo(record::getId)
|
||||||
|
.set(commentId).equalTo(record::getCommentId)
|
||||||
|
.set(replyContent).equalTo(record::getReplyContent)
|
||||||
|
.set(location).equalTo(record::getLocation)
|
||||||
|
.set(auditStatus).equalTo(record::getAuditStatus)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
|
.set(createUserId).equalTo(record::getCreateUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
static UpdateDSL<UpdateModel> updateSelectiveColumns(BookCommentReply record, UpdateDSL<UpdateModel> dsl) {
|
||||||
|
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||||
|
.set(commentId).equalToWhenPresent(record::getCommentId)
|
||||||
|
.set(replyContent).equalToWhenPresent(record::getReplyContent)
|
||||||
|
.set(location).equalToWhenPresent(record::getLocation)
|
||||||
|
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
|
.set(createUserId).equalToWhenPresent(record::getCreateUserId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKey(BookCommentReply record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(commentId).equalTo(record::getCommentId)
|
||||||
|
.set(replyContent).equalTo(record::getReplyContent)
|
||||||
|
.set(location).equalTo(record::getLocation)
|
||||||
|
.set(auditStatus).equalTo(record::getAuditStatus)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
|
.set(createUserId).equalTo(record::getCreateUserId)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKeySelective(BookCommentReply record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(commentId).equalToWhenPresent(record::getCommentId)
|
||||||
|
.set(replyContent).equalToWhenPresent(record::getReplyContent)
|
||||||
|
.set(location).equalToWhenPresent(record::getLocation)
|
||||||
|
.set(auditStatus).equalToWhenPresent(record::getAuditStatus)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
|
.set(createUserId).equalToWhenPresent(record::getCreateUserId)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -37,6 +37,9 @@ public final class CrawlSingleTaskDynamicSqlSupport {
|
|||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
public static final SqlColumn<Byte> excCount = crawlSingleTask.excCount;
|
public static final SqlColumn<Byte> excCount = crawlSingleTask.excCount;
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
public static final SqlColumn<Integer> crawlChapters = crawlSingleTask.crawlChapters;
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
public static final SqlColumn<Date> createTime = crawlSingleTask.createTime;
|
public static final SqlColumn<Date> createTime = crawlSingleTask.createTime;
|
||||||
|
|
||||||
@ -60,6 +63,8 @@ public final class CrawlSingleTaskDynamicSqlSupport {
|
|||||||
|
|
||||||
public final SqlColumn<Byte> excCount = column("exc_count", JDBCType.TINYINT);
|
public final SqlColumn<Byte> excCount = column("exc_count", JDBCType.TINYINT);
|
||||||
|
|
||||||
|
public final SqlColumn<Integer> crawlChapters = column("crawl_chapters", JDBCType.INTEGER);
|
||||||
|
|
||||||
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
public final SqlColumn<Date> createTime = column("create_time", JDBCType.TIMESTAMP);
|
||||||
|
|
||||||
public CrawlSingleTask() {
|
public CrawlSingleTask() {
|
||||||
|
@ -35,7 +35,7 @@ import org.mybatis.dynamic.sql.util.mybatis3.MyBatis3Utils;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface CrawlSingleTaskMapper {
|
public interface CrawlSingleTaskMapper {
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
BasicColumn[] selectList = BasicColumn.columnList(id, sourceId, sourceName, sourceBookId, catId, bookName, authorName, taskStatus, excCount, createTime);
|
BasicColumn[] selectList = BasicColumn.columnList(id, sourceId, sourceName, sourceBookId, catId, bookName, authorName, taskStatus, excCount, crawlChapters, createTime);
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
@SelectProvider(type=SqlProviderAdapter.class, method="select")
|
||||||
@ -70,6 +70,7 @@ public interface CrawlSingleTaskMapper {
|
|||||||
@Result(column="author_name", property="authorName", jdbcType=JdbcType.VARCHAR),
|
@Result(column="author_name", property="authorName", jdbcType=JdbcType.VARCHAR),
|
||||||
@Result(column="task_status", property="taskStatus", jdbcType=JdbcType.TINYINT),
|
@Result(column="task_status", property="taskStatus", jdbcType=JdbcType.TINYINT),
|
||||||
@Result(column="exc_count", property="excCount", jdbcType=JdbcType.TINYINT),
|
@Result(column="exc_count", property="excCount", jdbcType=JdbcType.TINYINT),
|
||||||
|
@Result(column="crawl_chapters", property="crawlChapters", jdbcType=JdbcType.INTEGER),
|
||||||
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
@Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP)
|
||||||
})
|
})
|
||||||
List<CrawlSingleTask> selectMany(SelectStatementProvider selectStatement);
|
List<CrawlSingleTask> selectMany(SelectStatementProvider selectStatement);
|
||||||
@ -90,7 +91,7 @@ public interface CrawlSingleTaskMapper {
|
|||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
default int deleteByPrimaryKey(Long id_) {
|
default int deleteByPrimaryKey(Long id_) {
|
||||||
return delete(c ->
|
return delete(c ->
|
||||||
c.where(id, isEqualTo(id_))
|
c.where(id, isEqualTo(id_))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -99,15 +100,16 @@ public interface CrawlSingleTaskMapper {
|
|||||||
default int insert(CrawlSingleTask record) {
|
default int insert(CrawlSingleTask record) {
|
||||||
return MyBatis3Utils.insert(this::insert, record, crawlSingleTask, c ->
|
return MyBatis3Utils.insert(this::insert, record, crawlSingleTask, c ->
|
||||||
c.map(id).toProperty("id")
|
c.map(id).toProperty("id")
|
||||||
.map(sourceId).toProperty("sourceId")
|
.map(sourceId).toProperty("sourceId")
|
||||||
.map(sourceName).toProperty("sourceName")
|
.map(sourceName).toProperty("sourceName")
|
||||||
.map(sourceBookId).toProperty("sourceBookId")
|
.map(sourceBookId).toProperty("sourceBookId")
|
||||||
.map(catId).toProperty("catId")
|
.map(catId).toProperty("catId")
|
||||||
.map(bookName).toProperty("bookName")
|
.map(bookName).toProperty("bookName")
|
||||||
.map(authorName).toProperty("authorName")
|
.map(authorName).toProperty("authorName")
|
||||||
.map(taskStatus).toProperty("taskStatus")
|
.map(taskStatus).toProperty("taskStatus")
|
||||||
.map(excCount).toProperty("excCount")
|
.map(excCount).toProperty("excCount")
|
||||||
.map(createTime).toProperty("createTime")
|
.map(crawlChapters).toProperty("crawlChapters")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,15 +117,16 @@ public interface CrawlSingleTaskMapper {
|
|||||||
default int insertMultiple(Collection<CrawlSingleTask> records) {
|
default int insertMultiple(Collection<CrawlSingleTask> records) {
|
||||||
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, crawlSingleTask, c ->
|
return MyBatis3Utils.insertMultiple(this::insertMultiple, records, crawlSingleTask, c ->
|
||||||
c.map(id).toProperty("id")
|
c.map(id).toProperty("id")
|
||||||
.map(sourceId).toProperty("sourceId")
|
.map(sourceId).toProperty("sourceId")
|
||||||
.map(sourceName).toProperty("sourceName")
|
.map(sourceName).toProperty("sourceName")
|
||||||
.map(sourceBookId).toProperty("sourceBookId")
|
.map(sourceBookId).toProperty("sourceBookId")
|
||||||
.map(catId).toProperty("catId")
|
.map(catId).toProperty("catId")
|
||||||
.map(bookName).toProperty("bookName")
|
.map(bookName).toProperty("bookName")
|
||||||
.map(authorName).toProperty("authorName")
|
.map(authorName).toProperty("authorName")
|
||||||
.map(taskStatus).toProperty("taskStatus")
|
.map(taskStatus).toProperty("taskStatus")
|
||||||
.map(excCount).toProperty("excCount")
|
.map(excCount).toProperty("excCount")
|
||||||
.map(createTime).toProperty("createTime")
|
.map(crawlChapters).toProperty("crawlChapters")
|
||||||
|
.map(createTime).toProperty("createTime")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,15 +134,16 @@ public interface CrawlSingleTaskMapper {
|
|||||||
default int insertSelective(CrawlSingleTask record) {
|
default int insertSelective(CrawlSingleTask record) {
|
||||||
return MyBatis3Utils.insert(this::insert, record, crawlSingleTask, c ->
|
return MyBatis3Utils.insert(this::insert, record, crawlSingleTask, c ->
|
||||||
c.map(id).toPropertyWhenPresent("id", record::getId)
|
c.map(id).toPropertyWhenPresent("id", record::getId)
|
||||||
.map(sourceId).toPropertyWhenPresent("sourceId", record::getSourceId)
|
.map(sourceId).toPropertyWhenPresent("sourceId", record::getSourceId)
|
||||||
.map(sourceName).toPropertyWhenPresent("sourceName", record::getSourceName)
|
.map(sourceName).toPropertyWhenPresent("sourceName", record::getSourceName)
|
||||||
.map(sourceBookId).toPropertyWhenPresent("sourceBookId", record::getSourceBookId)
|
.map(sourceBookId).toPropertyWhenPresent("sourceBookId", record::getSourceBookId)
|
||||||
.map(catId).toPropertyWhenPresent("catId", record::getCatId)
|
.map(catId).toPropertyWhenPresent("catId", record::getCatId)
|
||||||
.map(bookName).toPropertyWhenPresent("bookName", record::getBookName)
|
.map(bookName).toPropertyWhenPresent("bookName", record::getBookName)
|
||||||
.map(authorName).toPropertyWhenPresent("authorName", record::getAuthorName)
|
.map(authorName).toPropertyWhenPresent("authorName", record::getAuthorName)
|
||||||
.map(taskStatus).toPropertyWhenPresent("taskStatus", record::getTaskStatus)
|
.map(taskStatus).toPropertyWhenPresent("taskStatus", record::getTaskStatus)
|
||||||
.map(excCount).toPropertyWhenPresent("excCount", record::getExcCount)
|
.map(excCount).toPropertyWhenPresent("excCount", record::getExcCount)
|
||||||
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
.map(crawlChapters).toPropertyWhenPresent("crawlChapters", record::getCrawlChapters)
|
||||||
|
.map(createTime).toPropertyWhenPresent("createTime", record::getCreateTime)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,35 +177,7 @@ public interface CrawlSingleTaskMapper {
|
|||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
static UpdateDSL<UpdateModel> updateAllColumns(CrawlSingleTask record, UpdateDSL<UpdateModel> dsl) {
|
static UpdateDSL<UpdateModel> updateAllColumns(CrawlSingleTask record, UpdateDSL<UpdateModel> dsl) {
|
||||||
return dsl.set(id).equalTo(record::getId)
|
return dsl.set(id).equalTo(record::getId)
|
||||||
.set(sourceId).equalTo(record::getSourceId)
|
.set(sourceId).equalTo(record::getSourceId)
|
||||||
.set(sourceName).equalTo(record::getSourceName)
|
|
||||||
.set(sourceBookId).equalTo(record::getSourceBookId)
|
|
||||||
.set(catId).equalTo(record::getCatId)
|
|
||||||
.set(bookName).equalTo(record::getBookName)
|
|
||||||
.set(authorName).equalTo(record::getAuthorName)
|
|
||||||
.set(taskStatus).equalTo(record::getTaskStatus)
|
|
||||||
.set(excCount).equalTo(record::getExcCount)
|
|
||||||
.set(createTime).equalTo(record::getCreateTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
|
||||||
static UpdateDSL<UpdateModel> updateSelectiveColumns(CrawlSingleTask record, UpdateDSL<UpdateModel> dsl) {
|
|
||||||
return dsl.set(id).equalToWhenPresent(record::getId)
|
|
||||||
.set(sourceId).equalToWhenPresent(record::getSourceId)
|
|
||||||
.set(sourceName).equalToWhenPresent(record::getSourceName)
|
|
||||||
.set(sourceBookId).equalToWhenPresent(record::getSourceBookId)
|
|
||||||
.set(catId).equalToWhenPresent(record::getCatId)
|
|
||||||
.set(bookName).equalToWhenPresent(record::getBookName)
|
|
||||||
.set(authorName).equalToWhenPresent(record::getAuthorName)
|
|
||||||
.set(taskStatus).equalToWhenPresent(record::getTaskStatus)
|
|
||||||
.set(excCount).equalToWhenPresent(record::getExcCount)
|
|
||||||
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
|
||||||
default int updateByPrimaryKey(CrawlSingleTask record) {
|
|
||||||
return update(c ->
|
|
||||||
c.set(sourceId).equalTo(record::getSourceId)
|
|
||||||
.set(sourceName).equalTo(record::getSourceName)
|
.set(sourceName).equalTo(record::getSourceName)
|
||||||
.set(sourceBookId).equalTo(record::getSourceBookId)
|
.set(sourceBookId).equalTo(record::getSourceBookId)
|
||||||
.set(catId).equalTo(record::getCatId)
|
.set(catId).equalTo(record::getCatId)
|
||||||
@ -209,15 +185,14 @@ public interface CrawlSingleTaskMapper {
|
|||||||
.set(authorName).equalTo(record::getAuthorName)
|
.set(authorName).equalTo(record::getAuthorName)
|
||||||
.set(taskStatus).equalTo(record::getTaskStatus)
|
.set(taskStatus).equalTo(record::getTaskStatus)
|
||||||
.set(excCount).equalTo(record::getExcCount)
|
.set(excCount).equalTo(record::getExcCount)
|
||||||
.set(createTime).equalTo(record::getCreateTime)
|
.set(crawlChapters).equalTo(record::getCrawlChapters)
|
||||||
.where(id, isEqualTo(record::getId))
|
.set(createTime).equalTo(record::getCreateTime);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
default int updateByPrimaryKeySelective(CrawlSingleTask record) {
|
static UpdateDSL<UpdateModel> updateSelectiveColumns(CrawlSingleTask record, UpdateDSL<UpdateModel> dsl) {
|
||||||
return update(c ->
|
return dsl.set(id).equalToWhenPresent(record::getId)
|
||||||
c.set(sourceId).equalToWhenPresent(record::getSourceId)
|
.set(sourceId).equalToWhenPresent(record::getSourceId)
|
||||||
.set(sourceName).equalToWhenPresent(record::getSourceName)
|
.set(sourceName).equalToWhenPresent(record::getSourceName)
|
||||||
.set(sourceBookId).equalToWhenPresent(record::getSourceBookId)
|
.set(sourceBookId).equalToWhenPresent(record::getSourceBookId)
|
||||||
.set(catId).equalToWhenPresent(record::getCatId)
|
.set(catId).equalToWhenPresent(record::getCatId)
|
||||||
@ -225,8 +200,41 @@ public interface CrawlSingleTaskMapper {
|
|||||||
.set(authorName).equalToWhenPresent(record::getAuthorName)
|
.set(authorName).equalToWhenPresent(record::getAuthorName)
|
||||||
.set(taskStatus).equalToWhenPresent(record::getTaskStatus)
|
.set(taskStatus).equalToWhenPresent(record::getTaskStatus)
|
||||||
.set(excCount).equalToWhenPresent(record::getExcCount)
|
.set(excCount).equalToWhenPresent(record::getExcCount)
|
||||||
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
.set(crawlChapters).equalToWhenPresent(record::getCrawlChapters)
|
||||||
.where(id, isEqualTo(record::getId))
|
.set(createTime).equalToWhenPresent(record::getCreateTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKey(CrawlSingleTask record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(sourceId).equalTo(record::getSourceId)
|
||||||
|
.set(sourceName).equalTo(record::getSourceName)
|
||||||
|
.set(sourceBookId).equalTo(record::getSourceBookId)
|
||||||
|
.set(catId).equalTo(record::getCatId)
|
||||||
|
.set(bookName).equalTo(record::getBookName)
|
||||||
|
.set(authorName).equalTo(record::getAuthorName)
|
||||||
|
.set(taskStatus).equalTo(record::getTaskStatus)
|
||||||
|
.set(excCount).equalTo(record::getExcCount)
|
||||||
|
.set(crawlChapters).equalTo(record::getCrawlChapters)
|
||||||
|
.set(createTime).equalTo(record::getCreateTime)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Generated("org.mybatis.generator.api.MyBatisGenerator")
|
||||||
|
default int updateByPrimaryKeySelective(CrawlSingleTask record) {
|
||||||
|
return update(c ->
|
||||||
|
c.set(sourceId).equalToWhenPresent(record::getSourceId)
|
||||||
|
.set(sourceName).equalToWhenPresent(record::getSourceName)
|
||||||
|
.set(sourceBookId).equalToWhenPresent(record::getSourceBookId)
|
||||||
|
.set(catId).equalToWhenPresent(record::getCatId)
|
||||||
|
.set(bookName).equalToWhenPresent(record::getBookName)
|
||||||
|
.set(authorName).equalToWhenPresent(record::getAuthorName)
|
||||||
|
.set(taskStatus).equalToWhenPresent(record::getTaskStatus)
|
||||||
|
.set(excCount).equalToWhenPresent(record::getExcCount)
|
||||||
|
.set(crawlChapters).equalToWhenPresent(record::getCrawlChapters)
|
||||||
|
.set(createTime).equalToWhenPresent(record::getCreateTime)
|
||||||
|
.where(id, isEqualTo(record::getId))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.1.3</version>
|
<version>5.2.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -153,6 +153,14 @@ public class CrawlController {
|
|||||||
return RestResult.ok();
|
return RestResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采集任务进度查询
|
||||||
|
* */
|
||||||
|
@GetMapping("getTaskProgress/{id}")
|
||||||
|
public RestResult<Integer> getTaskProgress(@PathVariable("id") Long id){
|
||||||
|
return RestResult.ok(crawlService.getTaskProgress(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -5,21 +5,18 @@ import com.java2nb.novel.core.utils.StringUtil;
|
|||||||
import com.java2nb.novel.entity.Book;
|
import com.java2nb.novel.entity.Book;
|
||||||
import com.java2nb.novel.entity.BookContent;
|
import com.java2nb.novel.entity.BookContent;
|
||||||
import com.java2nb.novel.entity.BookIndex;
|
import com.java2nb.novel.entity.BookIndex;
|
||||||
|
import com.java2nb.novel.entity.CrawlSingleTask;
|
||||||
import com.java2nb.novel.utils.Constants;
|
import com.java2nb.novel.utils.Constants;
|
||||||
import com.java2nb.novel.utils.CrawlHttpClient;
|
import com.java2nb.novel.utils.CrawlHttpClient;
|
||||||
import io.github.xxyopen.util.IdWorker;
|
import io.github.xxyopen.util.IdWorker;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@ -37,6 +34,25 @@ public class CrawlParser {
|
|||||||
|
|
||||||
private final CrawlHttpClient crawlHttpClient;
|
private final CrawlHttpClient crawlHttpClient;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 爬虫任务进度
|
||||||
|
*/
|
||||||
|
private final Map<Long, Integer> crawlTaskProgress = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取爬虫任务进度
|
||||||
|
*/
|
||||||
|
public Integer getCrawlTaskProgress(Long taskId) {
|
||||||
|
return crawlTaskProgress.get(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 移除爬虫任务进度
|
||||||
|
*/
|
||||||
|
public void removeCrawlTaskProgress(Long taskId) {
|
||||||
|
crawlTaskProgress.remove(taskId);
|
||||||
|
}
|
||||||
|
|
||||||
public void parseBook(RuleBean ruleBean, String bookId, CrawlBookHandler handler)
|
public void parseBook(RuleBean ruleBean, String bookId, CrawlBookHandler handler)
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
Book book = new Book();
|
Book book = new Book();
|
||||||
@ -100,6 +116,22 @@ public class CrawlParser {
|
|||||||
.replaceAll("<p>\\s*</p>", "")
|
.replaceAll("<p>\\s*</p>", "")
|
||||||
.replaceAll("<p>", "")
|
.replaceAll("<p>", "")
|
||||||
.replaceAll("</p>", "<br/>");
|
.replaceAll("</p>", "<br/>");
|
||||||
|
// 小说简介过滤
|
||||||
|
String filterDesc = ruleBean.getFilterDesc();
|
||||||
|
if (StringUtils.isNotBlank(filterDesc)) {
|
||||||
|
String[] filterRules = filterDesc.replace("\r\n", "\n").split("\n");
|
||||||
|
for (String filterRule : filterRules) {
|
||||||
|
if (StringUtils.isNotBlank(filterRule)) {
|
||||||
|
desc = desc.replaceAll(filterRule, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 去除小说简介前后空格
|
||||||
|
desc = desc.trim();
|
||||||
|
// 去除小说简介末尾冗余的小说名
|
||||||
|
if (desc.endsWith(bookName)) {
|
||||||
|
desc = desc.substring(0, desc.length() - bookName.length());
|
||||||
|
}
|
||||||
//设置书籍简介
|
//设置书籍简介
|
||||||
book.setBookDesc(desc);
|
book.setBookDesc(desc);
|
||||||
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
if (StringUtils.isNotBlank(ruleBean.getStatusPatten())) {
|
||||||
@ -140,7 +172,7 @@ public class CrawlParser {
|
|||||||
} else if (book.getVisitCount() != null && book.getScore() == null) {
|
} else if (book.getVisitCount() != null && book.getScore() == null) {
|
||||||
//随机根据访问次数生成评分
|
//随机根据访问次数生成评分
|
||||||
book.setScore(RandomBookInfoUtil.getScoreByVisitCount(book.getVisitCount()));
|
book.setScore(RandomBookInfoUtil.getScoreByVisitCount(book.getVisitCount()));
|
||||||
} else if (book.getVisitCount() == null && book.getScore() == null) {
|
} else if (book.getVisitCount() == null) {
|
||||||
//都没有,设置成固定值
|
//都没有,设置成固定值
|
||||||
book.setVisitCount(Constants.VISIT_COUNT_DEFAULT);
|
book.setVisitCount(Constants.VISIT_COUNT_DEFAULT);
|
||||||
book.setScore(6.5f);
|
book.setScore(6.5f);
|
||||||
@ -151,7 +183,13 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean,
|
public boolean parseBookIndexAndContent(String sourceBookId, Book book, RuleBean ruleBean,
|
||||||
Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler) throws InterruptedException{
|
Map<Integer, BookIndex> existBookIndexMap, CrawlBookChapterHandler handler, CrawlSingleTask task)
|
||||||
|
throws InterruptedException {
|
||||||
|
|
||||||
|
if (task != null) {
|
||||||
|
// 开始采集
|
||||||
|
crawlTaskProgress.put(task.getId(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
Date currentDate = new Date();
|
Date currentDate = new Date();
|
||||||
|
|
||||||
@ -209,7 +247,7 @@ public class CrawlParser {
|
|||||||
calResult = sourceIndexId.substring(0, sourceBookId.length() - y);
|
calResult = sourceIndexId.substring(0, sourceBookId.length() - y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (calResult.length() == 0) {
|
if (calResult.isEmpty()) {
|
||||||
calResult = "0";
|
calResult = "0";
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -238,6 +276,8 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 去除小说内容末尾的所有换行
|
||||||
|
content = removeTrailingBrTags(content);
|
||||||
//插入章节目录和章节内容
|
//插入章节目录和章节内容
|
||||||
BookIndex bookIndex = new BookIndex();
|
BookIndex bookIndex = new BookIndex();
|
||||||
bookIndex.setIndexName(indexName);
|
bookIndex.setIndexName(indexName);
|
||||||
@ -273,6 +313,11 @@ public class CrawlParser {
|
|||||||
}
|
}
|
||||||
bookIndex.setUpdateTime(currentDate);
|
bookIndex.setUpdateTime(currentDate);
|
||||||
|
|
||||||
|
if (task != null) {
|
||||||
|
// 更新采集进度
|
||||||
|
crawlTaskProgress.put(task.getId(), indexList.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,10 +327,10 @@ public class CrawlParser {
|
|||||||
isFindIndex = indexIdMatch.find() & indexNameMatch.find();
|
isFindIndex = indexIdMatch.find() & indexNameMatch.find();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indexList.size() > 0) {
|
if (!indexList.isEmpty()) {
|
||||||
//如果有爬到最新章节,则设置小说主表的最新章节信息
|
//如果有爬到最新章节,则设置小说主表的最新章节信息
|
||||||
//获取爬取到的最新章节
|
//获取爬取到的最新章节
|
||||||
BookIndex lastIndex = indexList.get(indexList.size() - 1);
|
BookIndex lastIndex = indexList.getLast();
|
||||||
book.setLastIndexId(lastIndex.getId());
|
book.setLastIndexId(lastIndex.getId());
|
||||||
book.setLastIndexName(lastIndex.getIndexName());
|
book.setLastIndexName(lastIndex.getIndexName());
|
||||||
book.setLastIndexUpdateTime(currentDate);
|
book.setLastIndexUpdateTime(currentDate);
|
||||||
@ -294,7 +339,7 @@ public class CrawlParser {
|
|||||||
book.setWordCount(totalWordCount);
|
book.setWordCount(totalWordCount);
|
||||||
book.setUpdateTime(currentDate);
|
book.setUpdateTime(currentDate);
|
||||||
|
|
||||||
if (indexList.size() == contentList.size() && indexList.size() > 0) {
|
if (indexList.size() == contentList.size() && !indexList.isEmpty()) {
|
||||||
|
|
||||||
handler.handle(new ChapterBean() {{
|
handler.handle(new ChapterBean() {{
|
||||||
setBookIndexList(indexList);
|
setBookIndexList(indexList);
|
||||||
@ -314,4 +359,12 @@ public class CrawlParser {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除字符串末尾的所有 <br> 类似标签(允许各种空格)
|
||||||
|
*/
|
||||||
|
public static String removeTrailingBrTags(String str) {
|
||||||
|
return str.replaceAll("(?i)(?:\\s*<\\s*br\\s*/?\\s*>)++(?:\\s|\\u3000)*$", "");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,7 @@ public class RuleBean {
|
|||||||
private String visitCountPatten;
|
private String visitCountPatten;
|
||||||
private String descStart;
|
private String descStart;
|
||||||
private String descEnd;
|
private String descEnd;
|
||||||
|
private String filterDesc;
|
||||||
private String upadateTimePatten;
|
private String upadateTimePatten;
|
||||||
private String upadateTimeFormatPatten;
|
private String upadateTimeFormatPatten;
|
||||||
private String bookIndexUrl;
|
private String bookIndexUrl;
|
||||||
|
@ -74,8 +74,10 @@ public class StarterListener implements ServletContextInitializer {
|
|||||||
needUpdateBook.getId());
|
needUpdateBook.getId());
|
||||||
//解析章节目录
|
//解析章节目录
|
||||||
crawlParser.parseBookIndexAndContent(needUpdateBook.getCrawlBookId(), book,
|
crawlParser.parseBookIndexAndContent(needUpdateBook.getCrawlBookId(), book,
|
||||||
ruleBean, existBookIndexMap, chapter -> bookService.updateBookAndIndexAndContent(book, chapter.getBookIndexList(),
|
ruleBean, existBookIndexMap,
|
||||||
chapter.getBookContentList(), existBookIndexMap));
|
chapter -> bookService.updateBookAndIndexAndContent(book,
|
||||||
|
chapter.getBookIndexList(),
|
||||||
|
chapter.getBookContentList(), existBookIndexMap), null);
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
@ -107,9 +109,8 @@ public class StarterListener implements ServletContextInitializer {
|
|||||||
//查询爬虫规则
|
//查询爬虫规则
|
||||||
CrawlSource source = crawlService.queryCrawlSource(task.getSourceId());
|
CrawlSource source = crawlService.queryCrawlSource(task.getSourceId());
|
||||||
RuleBean ruleBean = new ObjectMapper().readValue(source.getCrawlRule(), RuleBean.class);
|
RuleBean ruleBean = new ObjectMapper().readValue(source.getCrawlRule(), RuleBean.class);
|
||||||
|
|
||||||
if (crawlService.parseBookAndSave(task.getCatId(), ruleBean, task.getSourceId(),
|
if (crawlService.parseBookAndSave(task.getCatId(), ruleBean, task.getSourceId(),
|
||||||
task.getSourceBookId())) {
|
task.getSourceBookId(), task)) {
|
||||||
//采集成功
|
//采集成功
|
||||||
crawlStatus = 1;
|
crawlStatus = 1;
|
||||||
}
|
}
|
||||||
@ -122,6 +123,7 @@ public class StarterListener implements ServletContextInitializer {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (task != null) {
|
if (task != null) {
|
||||||
crawlService.updateCrawlSingleTask(task, crawlStatus);
|
crawlService.updateCrawlSingleTask(task, crawlStatus);
|
||||||
}
|
}
|
||||||
|
@ -47,13 +47,15 @@ public interface CrawlService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 采集并保存小说
|
* 采集并保存小说
|
||||||
* @param catId 分类ID
|
*
|
||||||
* @param bookId 小说ID
|
* @param catId 分类ID
|
||||||
* @param sourceId 源ID
|
|
||||||
* @param ruleBean 采集规则\
|
* @param ruleBean 采集规则\
|
||||||
|
* @param sourceId 源ID
|
||||||
|
* @param bookId 小说ID
|
||||||
|
* @param task
|
||||||
* @return true:成功,false:失败
|
* @return true:成功,false:失败
|
||||||
* */
|
*/
|
||||||
boolean parseBookAndSave(int catId, RuleBean ruleBean, Integer sourceId, String bookId) throws InterruptedException;
|
boolean parseBookAndSave(int catId, RuleBean ruleBean, Integer sourceId, String bookId, CrawlSingleTask task) throws InterruptedException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据爬虫状态查询爬虫源集合
|
* 根据爬虫状态查询爬虫源集合
|
||||||
@ -117,4 +119,9 @@ public interface CrawlService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CrawlSource getCrawlSource(Integer id);
|
CrawlSource getCrawlSource(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采集任务进度查询
|
||||||
|
* */
|
||||||
|
Integer getTaskProgress(Long taskId);
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,10 @@ package com.java2nb.novel.service.impl;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageHelper;
|
||||||
import com.java2nb.novel.core.cache.CacheKey;
|
|
||||||
import com.java2nb.novel.core.cache.CacheService;
|
import com.java2nb.novel.core.cache.CacheService;
|
||||||
import com.java2nb.novel.core.crawl.CrawlParser;
|
import com.java2nb.novel.core.crawl.CrawlParser;
|
||||||
import com.java2nb.novel.core.crawl.RuleBean;
|
import com.java2nb.novel.core.crawl.RuleBean;
|
||||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||||
import com.java2nb.novel.core.utils.SpringUtil;
|
|
||||||
import com.java2nb.novel.entity.Book;
|
import com.java2nb.novel.entity.Book;
|
||||||
import com.java2nb.novel.entity.CrawlSingleTask;
|
import com.java2nb.novel.entity.CrawlSingleTask;
|
||||||
import com.java2nb.novel.entity.CrawlSource;
|
import com.java2nb.novel.entity.CrawlSource;
|
||||||
@ -60,8 +58,6 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
|
|
||||||
private final BookService bookService;
|
private final BookService bookService;
|
||||||
|
|
||||||
private final CacheService cacheService;
|
|
||||||
|
|
||||||
private final IdWorker idWorker = IdWorker.INSTANCE;
|
private final IdWorker idWorker = IdWorker.INSTANCE;
|
||||||
|
|
||||||
private final CrawlHttpClient crawlHttpClient;
|
private final CrawlHttpClient crawlHttpClient;
|
||||||
@ -198,6 +194,16 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
List<CrawlSingleTask> crawlSingleTasks = crawlSingleTaskMapper.selectMany(render);
|
List<CrawlSingleTask> crawlSingleTasks = crawlSingleTaskMapper.selectMany(render);
|
||||||
PageBean<CrawlSingleTask> pageBean = PageBuilder.build(crawlSingleTasks);
|
PageBean<CrawlSingleTask> pageBean = PageBuilder.build(crawlSingleTasks);
|
||||||
pageBean.setList(BeanUtil.copyList(crawlSingleTasks, CrawlSingleTaskVO.class));
|
pageBean.setList(BeanUtil.copyList(crawlSingleTasks, CrawlSingleTaskVO.class));
|
||||||
|
for (CrawlSingleTask crawlSingleTask : pageBean.getList()) {
|
||||||
|
if (crawlSingleTask.getTaskStatus() == 2
|
||||||
|
&& crawlParser.getCrawlTaskProgress(crawlSingleTask.getId()) != null) {
|
||||||
|
// 如果排队中的任务有任务进度,将排队中的任务状态修改成采集中并设置任务进度
|
||||||
|
crawlSingleTask.setTaskStatus((byte) 3);
|
||||||
|
crawlSingleTask.setCrawlChapters(crawlParser.getCrawlTaskProgress(crawlSingleTask.getId()));
|
||||||
|
// 只会有一个任务在采集中
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
return pageBean;
|
return pageBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,21 +233,27 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
excCount += 1;
|
excCount += 1;
|
||||||
task.setExcCount(excCount);
|
task.setExcCount(excCount);
|
||||||
if (status == 1 || excCount == 5) {
|
if (status == 1 || excCount == 5) {
|
||||||
//当采集成功或者采集次数等于5,则更新采集最终状态,并停止采集
|
// 当采集成功或者采集次数等于5,则更新采集最终状态,并停止采集
|
||||||
task.setTaskStatus(status);
|
task.setTaskStatus(status);
|
||||||
}
|
}
|
||||||
|
if (status == 1) {
|
||||||
|
// 当采集成功,保存采集的章节数量
|
||||||
|
task.setCrawlChapters(crawlParser.getCrawlTaskProgress(task.getId()));
|
||||||
|
}
|
||||||
crawlSingleTaskMapper.updateByPrimaryKeySelective(task);
|
crawlSingleTaskMapper.updateByPrimaryKeySelective(task);
|
||||||
|
// 删除任务进度
|
||||||
|
crawlParser.removeCrawlTaskProgress(task.getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CrawlSource getCrawlSource(Integer id) {
|
public CrawlSource getCrawlSource(Integer id) {
|
||||||
Optional<CrawlSource> opt = crawlSourceMapper.selectByPrimaryKey(id);
|
return crawlSourceMapper.selectByPrimaryKey(id).orElse(null);
|
||||||
if (opt.isPresent()) {
|
}
|
||||||
CrawlSource crawlSource = opt.get();
|
|
||||||
return crawlSource;
|
@Override
|
||||||
}
|
public Integer getTaskProgress(Long taskId) {
|
||||||
return null;
|
return Optional.ofNullable(crawlParser.getCrawlTaskProgress(taskId)).orElse(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -291,7 +303,7 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String bookId = bookIdMatcher.group(1);
|
String bookId = bookIdMatcher.group(1);
|
||||||
parseBookAndSave(catId, ruleBean, sourceId, bookId);
|
parseBookAndSave(catId, ruleBean, sourceId, bookId, null);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
log.error(e.getMessage(), e);
|
log.error(e.getMessage(), e);
|
||||||
//1.阻塞过程(使用了 sleep,同步锁的 wait,socket 中的 receiver,accept 等方法时)
|
//1.阻塞过程(使用了 sleep,同步锁的 wait,socket 中的 receiver,accept 等方法时)
|
||||||
@ -345,7 +357,7 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean parseBookAndSave(int catId, RuleBean ruleBean, Integer sourceId, String bookId)
|
public boolean parseBookAndSave(int catId, RuleBean ruleBean, Integer sourceId, String bookId, CrawlSingleTask task)
|
||||||
throws InterruptedException {
|
throws InterruptedException {
|
||||||
|
|
||||||
final AtomicBoolean parseResult = new AtomicBoolean(false);
|
final AtomicBoolean parseResult = new AtomicBoolean(false);
|
||||||
@ -378,7 +390,7 @@ public class CrawlServiceImpl implements CrawlService {
|
|||||||
new HashMap<>(0), chapter -> {
|
new HashMap<>(0), chapter -> {
|
||||||
bookService.saveBookAndIndexAndContent(book, chapter.getBookIndexList(),
|
bookService.saveBookAndIndexAndContent(book, chapter.getBookIndexList(),
|
||||||
chapter.getBookContentList());
|
chapter.getBookContentList());
|
||||||
});
|
}, task);
|
||||||
parseResult.set(parseIndexContentResult);
|
parseResult.set(parseIndexContentResult);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -110,7 +110,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -48,6 +48,9 @@
|
|||||||
<th class="name">
|
<th class="name">
|
||||||
采集小说作者名
|
采集小说作者名
|
||||||
</th>
|
</th>
|
||||||
|
<th class="goread">
|
||||||
|
采集进度
|
||||||
|
</th>
|
||||||
<th class="goread">
|
<th class="goread">
|
||||||
采集次数
|
采集次数
|
||||||
</th>
|
</th>
|
||||||
@ -113,9 +116,15 @@
|
|||||||
<script src="/javascript/header.js" type="text/javascript"></script>
|
<script src="/javascript/header.js" type="text/javascript"></script>
|
||||||
<script src="/javascript/user.js" type="text/javascript"></script>
|
<script src="/javascript/user.js" type="text/javascript"></script>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
search(1, 10);
|
let curr = 1;
|
||||||
|
let limit = 10;
|
||||||
|
|
||||||
function search(curr, limit) {
|
search();
|
||||||
|
setInterval(function(){
|
||||||
|
search();
|
||||||
|
}, 10000);
|
||||||
|
|
||||||
|
function search() {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
@ -140,10 +149,13 @@
|
|||||||
" " + crawlSource.authorName + "\n" +
|
" " + crawlSource.authorName + "\n" +
|
||||||
" </td>\n" +
|
" </td>\n" +
|
||||||
" <td class=\"goread\">\n" +
|
" <td class=\"goread\">\n" +
|
||||||
|
" " + crawlSource.crawlChapters + "\n" + "章" +
|
||||||
|
" </td>\n" +
|
||||||
|
" <td class=\"goread\">\n" +
|
||||||
" " + crawlSource.excCount + "\n" +
|
" " + crawlSource.excCount + "\n" +
|
||||||
" </td>\n" +
|
" </td>\n" +
|
||||||
" <td class=\"goread\">\n" +
|
" <td class=\"goread\">\n" +
|
||||||
" " + (crawlSource.taskStatus == 0 ? '采集失败' : (crawlSource.taskStatus == 1 ? '采集成功' : (crawlSource.excCount > 0 ? '采集中' : '排队中'))) + "\n" +
|
" " + (crawlSource.taskStatus == 0 ? '采集失败' : (crawlSource.taskStatus == 1 ? '采集成功' : (crawlSource.taskStatus == 3 || crawlSource.excCount > 0 ? '采集中' : '排队中'))) + "\n" +
|
||||||
" </td>\n" +
|
" </td>\n" +
|
||||||
" <td class=\"name\" valsc=\"291|2037554|1\">"
|
" <td class=\"name\" valsc=\"291|2037554|1\">"
|
||||||
+ crawlSource.createTime + "</td>\n" +
|
+ crawlSource.createTime + "</td>\n" +
|
||||||
@ -171,7 +183,9 @@
|
|||||||
|
|
||||||
//首次不执行
|
//首次不执行
|
||||||
if (!first) {
|
if (!first) {
|
||||||
search(obj.curr, obj.limit);
|
curr = obj.curr;
|
||||||
|
limit = obj.limit;
|
||||||
|
search();
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,9 @@
|
|||||||
示例:<b></p></b>
|
示例:<b></p></b>
|
||||||
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
||||||
</li>
|
</li>
|
||||||
|
示例:<b><span\s+class="allshow">([^/]+)</span></b>
|
||||||
|
<li><textarea id="filterDesc"
|
||||||
|
placeholder="过滤简介(多个内容换行)" rows="5" cols="52"></textarea></li>
|
||||||
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
||||||
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
||||||
placeholder="小说更新时间的正则表达式:"></li>
|
placeholder="小说更新时间的正则表达式:"></li>
|
||||||
@ -338,6 +341,9 @@
|
|||||||
|
|
||||||
crawlRule.descEnd = descEnd;
|
crawlRule.descEnd = descEnd;
|
||||||
|
|
||||||
|
var filterDesc = $("#filterDesc").val();
|
||||||
|
crawlRule.filterDesc = filterDesc;
|
||||||
|
|
||||||
var upadateTimePatten = $("#upadateTimePatten").val();
|
var upadateTimePatten = $("#upadateTimePatten").val();
|
||||||
|
|
||||||
if (upadateTimePatten.length > 0) {
|
if (upadateTimePatten.length > 0) {
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -226,7 +226,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -119,6 +119,9 @@
|
|||||||
示例:<b></p></b>
|
示例:<b></p></b>
|
||||||
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
<li><input type="text" id="descEnd" class="s_input icon_key" placeholder="小说简介结束截取字符串:">
|
||||||
</li>
|
</li>
|
||||||
|
示例:<b><span\s+class="allshow">([^/]+)</span></b>
|
||||||
|
<li><textarea id="filterDesc"
|
||||||
|
placeholder="过滤简介(多个内容换行)" rows="5" cols="52"></textarea></li>
|
||||||
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
示例:<b>更新:(\d+-\d+-\d+\s\d+:\d+:\d+)</a></b>
|
||||||
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
<li><input type="text" id="upadateTimePatten" class="s_input icon_key"
|
||||||
placeholder="小说更新时间的正则表达式:"></li>
|
placeholder="小说更新时间的正则表达式:"></li>
|
||||||
@ -214,7 +217,7 @@
|
|||||||
loadPage(data.data);
|
loadPage(data.data);
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -266,6 +269,7 @@
|
|||||||
$("#visitCountPatten").val(crawlRule.visitCountPatten);
|
$("#visitCountPatten").val(crawlRule.visitCountPatten);
|
||||||
$("#descStart").val(crawlRule.descStart);
|
$("#descStart").val(crawlRule.descStart);
|
||||||
$("#descEnd").val(crawlRule.descEnd);
|
$("#descEnd").val(crawlRule.descEnd);
|
||||||
|
$("#filterDesc").val(crawlRule.filterDesc);
|
||||||
$("#upadateTimePatten").val(crawlRule.upadateTimePatten);
|
$("#upadateTimePatten").val(crawlRule.upadateTimePatten);
|
||||||
$("#upadateTimeFormatPatten").val(crawlRule.upadateTimeFormatPatten);
|
$("#upadateTimeFormatPatten").val(crawlRule.upadateTimeFormatPatten);
|
||||||
$("#bookIndexUrl").val(crawlRule.bookIndexUrl);
|
$("#bookIndexUrl").val(crawlRule.bookIndexUrl);
|
||||||
@ -424,6 +428,9 @@
|
|||||||
|
|
||||||
crawlRule.descEnd = descEnd;
|
crawlRule.descEnd = descEnd;
|
||||||
|
|
||||||
|
var filterDesc = $("#filterDesc").val();
|
||||||
|
crawlRule.filterDesc = filterDesc;
|
||||||
|
|
||||||
var upadateTimePatten = $("#upadateTimePatten").val();
|
var upadateTimePatten = $("#upadateTimePatten").val();
|
||||||
|
|
||||||
if (upadateTimePatten.length > 0) {
|
if (upadateTimePatten.length > 0) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.1.3</version>
|
<version>5.2.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -61,6 +61,12 @@
|
|||||||
<groupId>org.springframework.ai</groupId>
|
<groupId>org.springframework.ai</groupId>
|
||||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.lionsoul</groupId>
|
||||||
|
<artifactId>ip2region</artifactId>
|
||||||
|
<version>2.7.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -2,16 +2,13 @@ package com.java2nb.novel.controller;
|
|||||||
|
|
||||||
import com.java2nb.novel.core.bean.UserDetails;
|
import com.java2nb.novel.core.bean.UserDetails;
|
||||||
import com.java2nb.novel.core.enums.ResponseStatus;
|
import com.java2nb.novel.core.enums.ResponseStatus;
|
||||||
import com.java2nb.novel.entity.Book;
|
import com.java2nb.novel.core.utils.IpUtil;
|
||||||
import com.java2nb.novel.entity.BookCategory;
|
import com.java2nb.novel.entity.*;
|
||||||
import com.java2nb.novel.entity.BookComment;
|
|
||||||
import com.java2nb.novel.entity.BookIndex;
|
|
||||||
import com.java2nb.novel.service.BookContentService;
|
import com.java2nb.novel.service.BookContentService;
|
||||||
import com.java2nb.novel.service.BookService;
|
import com.java2nb.novel.service.BookService;
|
||||||
import com.java2nb.novel.vo.BookCommentVO;
|
import com.java2nb.novel.service.IpLocationService;
|
||||||
import com.java2nb.novel.vo.BookSettingVO;
|
import com.java2nb.novel.service.LikeService;
|
||||||
import com.java2nb.novel.vo.BookSpVO;
|
import com.java2nb.novel.vo.*;
|
||||||
import com.java2nb.novel.vo.BookVO;
|
|
||||||
import io.github.xxyopen.model.page.PageBean;
|
import io.github.xxyopen.model.page.PageBean;
|
||||||
import io.github.xxyopen.model.page.builder.pagehelper.PageBuilder;
|
import io.github.xxyopen.model.page.builder.pagehelper.PageBuilder;
|
||||||
import io.github.xxyopen.model.resp.RestResult;
|
import io.github.xxyopen.model.resp.RestResult;
|
||||||
@ -37,6 +34,10 @@ public class BookController extends BaseController {
|
|||||||
|
|
||||||
private final Map<String, BookContentService> bookContentServiceMap;
|
private final Map<String, BookContentService> bookContentServiceMap;
|
||||||
|
|
||||||
|
private final IpLocationService ipLocationService;
|
||||||
|
|
||||||
|
private final LikeService likeService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询首页小说设置列表数据
|
* 查询首页小说设置列表数据
|
||||||
*/
|
*/
|
||||||
@ -149,6 +150,16 @@ public class BookController extends BaseController {
|
|||||||
return RestResult.ok(bookService.listCommentByPage(null, bookId, page, pageSize));
|
return RestResult.ok(bookService.listCommentByPage(null, bookId, page, pageSize));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询评论回复列表
|
||||||
|
*/
|
||||||
|
@GetMapping("listCommentReplyByPage")
|
||||||
|
public RestResult<PageBean<BookCommentReplyVO>> listCommentReplyByPage(@RequestParam("commentId") Long commentId,
|
||||||
|
@RequestParam(value = "curr", defaultValue = "1") int page,
|
||||||
|
@RequestParam(value = "limit", defaultValue = "5") int pageSize) {
|
||||||
|
return RestResult.ok(bookService.listCommentReplyByPage(null, commentId, page, pageSize));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增评价
|
* 新增评价
|
||||||
*/
|
*/
|
||||||
@ -158,10 +169,73 @@ public class BookController extends BaseController {
|
|||||||
if (userDetails == null) {
|
if (userDetails == null) {
|
||||||
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
||||||
}
|
}
|
||||||
|
comment.setLocation(ipLocationService.getLocation(IpUtil.getRealIp(request)));
|
||||||
bookService.addBookComment(userDetails.getId(), comment);
|
bookService.addBookComment(userDetails.getId(), comment);
|
||||||
return RestResult.ok();
|
return RestResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价点赞/取消点赞
|
||||||
|
*/
|
||||||
|
@PostMapping("toggleCommentLike")
|
||||||
|
public RestResult<?> toggleCommentLike(Long commentId, HttpServletRequest request) {
|
||||||
|
UserDetails userDetails = getUserDetails(request);
|
||||||
|
if (userDetails == null) {
|
||||||
|
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
||||||
|
}
|
||||||
|
return RestResult.ok(likeService.toggleCommentLike(commentId, userDetails.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价点踩/取消点踩
|
||||||
|
*/
|
||||||
|
@PostMapping("toggleCommentUnLike")
|
||||||
|
public RestResult<?> toggleCommentUnLike(Long commentId, HttpServletRequest request) {
|
||||||
|
UserDetails userDetails = getUserDetails(request);
|
||||||
|
if (userDetails == null) {
|
||||||
|
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
||||||
|
}
|
||||||
|
return RestResult.ok(likeService.toggleCommentUnLike(commentId, userDetails.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增回复
|
||||||
|
*/
|
||||||
|
@PostMapping("addCommentReply")
|
||||||
|
public RestResult<?> addCommentReply(BookCommentReply commentReply, HttpServletRequest request) {
|
||||||
|
UserDetails userDetails = getUserDetails(request);
|
||||||
|
if (userDetails == null) {
|
||||||
|
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
||||||
|
}
|
||||||
|
commentReply.setLocation(ipLocationService.getLocation(IpUtil.getRealIp(request)));
|
||||||
|
bookService.addBookCommentReply(userDetails.getId(), commentReply);
|
||||||
|
return RestResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复点赞/取消点赞
|
||||||
|
*/
|
||||||
|
@PostMapping("toggleReplyLike")
|
||||||
|
public RestResult<?> toggleReplyLike(Long replyId, HttpServletRequest request) {
|
||||||
|
UserDetails userDetails = getUserDetails(request);
|
||||||
|
if (userDetails == null) {
|
||||||
|
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
||||||
|
}
|
||||||
|
return RestResult.ok(likeService.toggleReplyLike(replyId, userDetails.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复点赞/取消点赞
|
||||||
|
*/
|
||||||
|
@PostMapping("toggleReplyUnLike")
|
||||||
|
public RestResult<?> toggleReplyUnLike(Long replyId, HttpServletRequest request) {
|
||||||
|
UserDetails userDetails = getUserDetails(request);
|
||||||
|
if (userDetails == null) {
|
||||||
|
return RestResult.fail(ResponseStatus.NO_LOGIN);
|
||||||
|
}
|
||||||
|
return RestResult.ok(likeService.toggleReplyUnLike(replyId, userDetails.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据小说ID查询小说前十条最新更新目录集合
|
* 根据小说ID查询小说前十条最新更新目录集合
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +50,7 @@ public class PayController extends BaseController {
|
|||||||
|
|
||||||
UserDetails userDetails = getUserDetails(request);
|
UserDetails userDetails = getUserDetails(request);
|
||||||
if (userDetails == null) {
|
if (userDetails == null) {
|
||||||
//未登录,跳转到登陆页面
|
//未登录,跳转到登录页面
|
||||||
httpResponse.sendRedirect("/user/login.html?originUrl=/pay/index.html");
|
httpResponse.sendRedirect("/user/login.html?originUrl=/pay/index.html");
|
||||||
} else {
|
} else {
|
||||||
//创建充值订单
|
//创建充值订单
|
||||||
|
@ -40,12 +40,12 @@ public class UserController extends BaseController {
|
|||||||
private final BookService bookService;
|
private final BookService bookService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登陆
|
* 登录
|
||||||
*/
|
*/
|
||||||
@PostMapping("login")
|
@PostMapping("login")
|
||||||
public RestResult<Map<String, Object>> login(User user) {
|
public RestResult<Map<String, Object>> login(User user) {
|
||||||
|
|
||||||
//登陆
|
//登录
|
||||||
UserDetails userDetails = userService.login(user);
|
UserDetails userDetails = userService.login(user);
|
||||||
|
|
||||||
Map<String, Object> data = new HashMap<>(1);
|
Map<String, Object> data = new HashMap<>(1);
|
||||||
|
@ -313,6 +313,16 @@ public class PageController extends BaseController {
|
|||||||
return "book/book_comment";
|
return "book/book_comment";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论回复页面
|
||||||
|
*/
|
||||||
|
@RequestMapping("/book/reply-{commentId}.html")
|
||||||
|
public String commentReplyList(@PathVariable("commentId") Long commentId, Model model) {
|
||||||
|
model.addAttribute("commentId", commentId);
|
||||||
|
model.addAttribute("commentContent", bookService.getBookComment(commentId).getCommentContent());
|
||||||
|
return "book/book_comment_reply";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新闻内容页面
|
* 新闻内容页面
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,55 @@
|
|||||||
|
package com.java2nb.novel.core.config;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.lionsoul.ip2region.xdb.Searcher;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IP 地址定位配置类
|
||||||
|
*
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
* @date 2025/6/30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Configuration
|
||||||
|
public class IpLocationConfig {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 使用 {@link Searcher} 实现高效的本地 IP 查询服务, 创建基于内存的 IP 地址查询对象,支持并发访问且仅需初始化一次。
|
||||||
|
*
|
||||||
|
* <p>该方法会将 ip2region.xdb 数据库文件加载到内存中,
|
||||||
|
* 并构建一个线程安全的 {@link Searcher} 实例,可用于高效、并发的 IP 地址定位查询。</p>
|
||||||
|
*
|
||||||
|
* <p>{@link Searcher} 实例是线程安全的,可以作为全局单例在整个应用中跨线程使用。</p>
|
||||||
|
*
|
||||||
|
* <p>通过配置 destroyMethod="close",确保在 Spring 容器关闭时自动释放底层资源。</p>
|
||||||
|
*/
|
||||||
|
@Bean(destroyMethod = "close")
|
||||||
|
public Searcher searcher() throws IOException {
|
||||||
|
// 1、从 classpath 加载整个 xdb 到内存。
|
||||||
|
try (InputStream inputStream = new ClassPathResource("ip2region.xdb").getInputStream()) {
|
||||||
|
File tempDbFile = File.createTempFile("ip2region", ".xdb");
|
||||||
|
try (FileOutputStream outputStream = new FileOutputStream(tempDbFile)) {
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
int bytesRead;
|
||||||
|
while ((bytesRead = inputStream.read(buffer)) != -1) {
|
||||||
|
outputStream.write(buffer, 0, bytesRead);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 确保程序退出时删除临时文件
|
||||||
|
tempDbFile.deleteOnExit();
|
||||||
|
byte[] cBuff = Searcher.loadContentFromFile(tempDbFile.getPath());
|
||||||
|
|
||||||
|
// 2、使用上述的 cBuff 创建一个完全基于内存的查询对象。
|
||||||
|
return Searcher.newWithBuffer(cBuff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
package com.java2nb.novel.core.serialize;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
import com.java2nb.novel.core.utils.DateUtil;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class TimeAgoFormatSerialize extends JsonSerializer<Date> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(Date s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
|
||||||
|
throws IOException {
|
||||||
|
|
||||||
|
if (s != null) {
|
||||||
|
jsonGenerator.writeString(DateUtil.formatTimeAgo(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -12,4 +12,5 @@ public interface FrontBookCommentMapper extends BookCommentMapper {
|
|||||||
|
|
||||||
List<BookCommentVO> listCommentByPage(@Param("userId") Long userId, @Param("bookId") Long bookId);
|
List<BookCommentVO> listCommentByPage(@Param("userId") Long userId, @Param("bookId") Long bookId);
|
||||||
|
|
||||||
|
void addReplyCount(@Param("commentId") Long commentId);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.java2nb.novel.mapper;
|
||||||
|
|
||||||
|
import com.java2nb.novel.vo.BookCommentReplyVO;
|
||||||
|
import com.java2nb.novel.vo.BookCommentVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Administrator
|
||||||
|
*/
|
||||||
|
public interface FrontBookCommentReplyMapper extends BookCommentReplyMapper {
|
||||||
|
|
||||||
|
List<BookCommentReplyVO> listCommentReplyByPage(@Param("userId") Long userId, @Param("commentId") Long commentId);
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,9 @@
|
|||||||
package com.java2nb.novel.service;
|
package com.java2nb.novel.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.java2nb.novel.vo.*;
|
||||||
import io.github.xxyopen.model.page.PageBean;
|
import io.github.xxyopen.model.page.PageBean;
|
||||||
import com.java2nb.novel.entity.*;
|
import com.java2nb.novel.entity.*;
|
||||||
import com.java2nb.novel.vo.BookCommentVO;
|
|
||||||
import com.java2nb.novel.vo.BookSettingVO;
|
|
||||||
import com.java2nb.novel.vo.BookSpVO;
|
|
||||||
import com.java2nb.novel.vo.BookVO;
|
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -295,4 +292,15 @@ public interface BookService {
|
|||||||
* 查询AI生成图片
|
* 查询AI生成图片
|
||||||
*/
|
*/
|
||||||
String queryAiGenPic(Long bookId);
|
String queryAiGenPic(Long bookId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增回复
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @param commentReply 回复内容
|
||||||
|
* */
|
||||||
|
void addBookCommentReply(Long userId, BookCommentReply commentReply);
|
||||||
|
|
||||||
|
PageBean<BookCommentReplyVO> listCommentReplyByPage(Long userId, Long commentId, int page, int pageSize);
|
||||||
|
|
||||||
|
BookComment getBookComment(Long commentId);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,24 @@
|
|||||||
|
package com.java2nb.novel.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IP 地址定位服务类
|
||||||
|
*
|
||||||
|
* <p>该服务用于实现 IP 地址到地理位置的查询功能,
|
||||||
|
* 包括国家、省份、城市等信息。</p>
|
||||||
|
*
|
||||||
|
* <p>此类设计为 Spring 管理的 Service Bean,支持在 Controller 或其他 Service 中注入使用。</p>
|
||||||
|
*
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
* @date 2025/6/30
|
||||||
|
*/
|
||||||
|
public interface IpLocationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 IP 地址查询地理位置信息
|
||||||
|
*
|
||||||
|
* @param ip 待查询的 IP 地址(IPv4)
|
||||||
|
* @return 如果是中国 IP,返回省份;否则返回国家
|
||||||
|
*/
|
||||||
|
String getLocation(String ip);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package com.java2nb.novel.service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 11797
|
||||||
|
*/
|
||||||
|
public interface LikeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论点赞或取消点赞
|
||||||
|
* @param commentId 被点赞的评论ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 返回点赞数量
|
||||||
|
*/
|
||||||
|
public Long toggleCommentLike(Long commentId, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论点踩或取消点踩
|
||||||
|
* @param commentId 被点踩的评论ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 返回点踩数量
|
||||||
|
*/
|
||||||
|
public Long toggleCommentUnLike(Long commentId, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取评论的点赞数量
|
||||||
|
* @param commentId 评论ID
|
||||||
|
* @return 点赞数
|
||||||
|
*/
|
||||||
|
public Long getCommentLikesCount(Long commentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取评论的点踩赞数量
|
||||||
|
* @param commentId 评论ID
|
||||||
|
* @return 点踩数
|
||||||
|
*/
|
||||||
|
public Long getCommentUnLikesCount(Long commentId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复点赞或取消点赞
|
||||||
|
* @param replyId 被点赞的回复ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 返回点赞数量
|
||||||
|
*/
|
||||||
|
public Long toggleReplyLike(Long replyId, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复点踩或取消点踩
|
||||||
|
* @param replyId 被点踩的回复ID
|
||||||
|
* @param userId 用户ID
|
||||||
|
* @return 返回点踩数量
|
||||||
|
*/
|
||||||
|
public Long toggleReplyUnLike(Long replyId, Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取回复的点赞数量
|
||||||
|
* @param replyId 回复ID
|
||||||
|
* @return 点赞数
|
||||||
|
*/
|
||||||
|
public Long getReplyLikesCount(Long replyId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取回复的点踩数量
|
||||||
|
* @param replyId 回复ID
|
||||||
|
* @return 点踩数
|
||||||
|
*/
|
||||||
|
public Long getReplyUnLikesCount(Long replyId);
|
||||||
|
|
||||||
|
}
|
@ -26,8 +26,8 @@ public interface UserService {
|
|||||||
UserDetails register(User user);
|
UserDetails register(User user);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户登陆
|
* 用户登录
|
||||||
* @param user 用户登陆信息类
|
* @param user 用户登录信息类
|
||||||
* @return jwt载体信息类
|
* @return jwt载体信息类
|
||||||
* */
|
* */
|
||||||
UserDetails login(User user);
|
UserDetails login(User user);
|
||||||
|
@ -15,10 +15,8 @@ import com.java2nb.novel.mapper.*;
|
|||||||
import com.java2nb.novel.service.AuthorService;
|
import com.java2nb.novel.service.AuthorService;
|
||||||
import com.java2nb.novel.service.BookService;
|
import com.java2nb.novel.service.BookService;
|
||||||
import com.java2nb.novel.service.FileService;
|
import com.java2nb.novel.service.FileService;
|
||||||
import com.java2nb.novel.vo.BookCommentVO;
|
import com.java2nb.novel.service.LikeService;
|
||||||
import com.java2nb.novel.vo.BookSettingVO;
|
import com.java2nb.novel.vo.*;
|
||||||
import com.java2nb.novel.vo.BookSpVO;
|
|
||||||
import com.java2nb.novel.vo.BookVO;
|
|
||||||
import io.github.xxyopen.model.page.PageBean;
|
import io.github.xxyopen.model.page.PageBean;
|
||||||
import io.github.xxyopen.model.page.builder.pagehelper.PageBuilder;
|
import io.github.xxyopen.model.page.builder.pagehelper.PageBuilder;
|
||||||
import io.github.xxyopen.util.IdWorker;
|
import io.github.xxyopen.util.IdWorker;
|
||||||
@ -87,6 +85,8 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
private final FrontBookCommentMapper bookCommentMapper;
|
private final FrontBookCommentMapper bookCommentMapper;
|
||||||
|
|
||||||
|
private final FrontBookCommentReplyMapper bookCommentReplyMapper;
|
||||||
|
|
||||||
private final BookAuthorMapper bookAuthorMapper;
|
private final BookAuthorMapper bookAuthorMapper;
|
||||||
|
|
||||||
private final CacheService cacheService;
|
private final CacheService cacheService;
|
||||||
@ -95,6 +95,8 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
private final FileService fileService;
|
private final FileService fileService;
|
||||||
|
|
||||||
|
private final LikeService likeService;
|
||||||
|
|
||||||
private final BookPriceProperties bookPriceConfig;
|
private final BookPriceProperties bookPriceConfig;
|
||||||
|
|
||||||
private final OpenAiImageModel openAiImageModel;
|
private final OpenAiImageModel openAiImageModel;
|
||||||
@ -391,7 +393,12 @@ public class BookServiceImpl implements BookService {
|
|||||||
@Override
|
@Override
|
||||||
public PageBean<BookCommentVO> listCommentByPage(Long userId, Long bookId, int page, int pageSize) {
|
public PageBean<BookCommentVO> listCommentByPage(Long userId, Long bookId, int page, int pageSize) {
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelper.startPage(page, pageSize);
|
||||||
return PageBuilder.build(bookCommentMapper.listCommentByPage(userId, bookId));
|
PageBean<BookCommentVO> pageBean = PageBuilder.build(bookCommentMapper.listCommentByPage(userId, bookId));
|
||||||
|
for (BookCommentVO bookCommentVO : pageBean.getList()) {
|
||||||
|
bookCommentVO.setLikesCount(likeService.getCommentLikesCount(bookCommentVO.getId()));
|
||||||
|
bookCommentVO.setUnLikesCount(likeService.getCommentUnLikesCount(bookCommentVO.getId()));
|
||||||
|
}
|
||||||
|
return pageBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@ -888,5 +895,33 @@ public class BookServiceImpl implements BookService {
|
|||||||
return cacheService.get(CacheKey.AI_GEN_PIC + bookId);
|
return cacheService.get(CacheKey.AI_GEN_PIC + bookId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void addBookCommentReply(Long userId, BookCommentReply commentReply) {
|
||||||
|
//增加回复
|
||||||
|
commentReply.setCreateUserId(userId);
|
||||||
|
commentReply.setCreateTime(new Date());
|
||||||
|
bookCommentReplyMapper.insertSelective(commentReply);
|
||||||
|
//增加评论回复数
|
||||||
|
bookCommentMapper.addReplyCount(commentReply.getCommentId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageBean<BookCommentReplyVO> listCommentReplyByPage(Long userId, Long commentId, int page, int pageSize) {
|
||||||
|
PageHelper.startPage(page, pageSize);
|
||||||
|
PageBean<BookCommentReplyVO> pageBean = PageBuilder.build(
|
||||||
|
bookCommentReplyMapper.listCommentReplyByPage(userId, commentId));
|
||||||
|
pageBean.getList().forEach(commentReply -> {
|
||||||
|
commentReply.setLikesCount(likeService.getReplyLikesCount(commentReply.getId()));
|
||||||
|
commentReply.setUnLikesCount(likeService.getReplyUnLikesCount(commentReply.getId()));
|
||||||
|
});
|
||||||
|
return pageBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BookComment getBookComment(Long commentId) {
|
||||||
|
return bookCommentMapper.selectByPrimaryKey(commentId).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.java2nb.novel.service.impl;
|
||||||
|
|
||||||
|
import com.java2nb.novel.core.utils.IpUtil;
|
||||||
|
import com.java2nb.novel.service.IpLocationService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.lionsoul.ip2region.xdb.Searcher;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IpLocationService 实现类
|
||||||
|
*
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
* @date 2025/6/30
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class IpLocationServiceImpl implements IpLocationService {
|
||||||
|
|
||||||
|
private final Searcher searcher;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getLocation(String ip) {
|
||||||
|
try {
|
||||||
|
// 示例返回:"中国|0|湖北省|武汉市|电信"
|
||||||
|
String region = searcher.search(ip);
|
||||||
|
String[] regions = region.split("\\|");
|
||||||
|
if (regions.length > 0) {
|
||||||
|
// 国家
|
||||||
|
String country = regions[0];
|
||||||
|
if ("0".equals(country)) {
|
||||||
|
// 内网IP,直接获取本机公网IP
|
||||||
|
String publicIp = IpUtil.getPublicIP();
|
||||||
|
log.info("内网IP:{},本机公网IP:{}", ip, publicIp);
|
||||||
|
if (StringUtils.hasText(publicIp)) {
|
||||||
|
return getLocation(publicIp);
|
||||||
|
}
|
||||||
|
} else if ("中国".equals(country)) {
|
||||||
|
// 是中国,则返回省份(第三个字段)
|
||||||
|
String province = regions.length > 2 ? regions[2] : "未知地区";
|
||||||
|
// 去掉最后一个“省”字
|
||||||
|
return province.endsWith("省") ? province.substring(0, province.length() - 1) : province;
|
||||||
|
} else {
|
||||||
|
// 非中国,返回国家名
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error(e.getMessage(), e);
|
||||||
|
}
|
||||||
|
return "未知地区";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,94 @@
|
|||||||
|
package com.java2nb.novel.service.impl;
|
||||||
|
|
||||||
|
import com.java2nb.novel.service.LikeService;
|
||||||
|
import jakarta.annotation.PostConstruct;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||||
|
import org.springframework.scripting.support.StaticScriptSource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xiongxiaoyang
|
||||||
|
* @date 2025/7/12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class LikeServiceImpl implements LikeService {
|
||||||
|
|
||||||
|
private final RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
|
private DefaultRedisScript<Long> toggleLikeScript;
|
||||||
|
|
||||||
|
private static final String COMMENT_LIKE_KEY_PREFIX = "like:comment:";
|
||||||
|
private static final String COMMENT_REPLY_LIKE_KEY_PREFIX = "like:comment:reply:";
|
||||||
|
private static final String COMMENT_UN_LIKE_KEY_PREFIX = "unlike:comment:";
|
||||||
|
private static final String COMMENT_REPLY_UN_LIKE_KEY_PREFIX = "unlike:comment:reply:";
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
// Lua 脚本保证原子性操作
|
||||||
|
String script = """
|
||||||
|
local key = KEYS[1]
|
||||||
|
local userId = ARGV[1]
|
||||||
|
|
||||||
|
local isLiked = redis.call('SISMEMBER', key, userId)
|
||||||
|
|
||||||
|
if isLiked == 1 then
|
||||||
|
redis.call('SREM', key, userId)
|
||||||
|
else
|
||||||
|
redis.call('SADD', key, userId)
|
||||||
|
end
|
||||||
|
|
||||||
|
return redis.call('SCARD', key)
|
||||||
|
""";
|
||||||
|
|
||||||
|
toggleLikeScript = new DefaultRedisScript<>();
|
||||||
|
toggleLikeScript.setScriptSource(new StaticScriptSource(script));
|
||||||
|
toggleLikeScript.setResultType(Long.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long toggleCommentLike(Long commentId, Long userId) {
|
||||||
|
return executeToggle(COMMENT_LIKE_KEY_PREFIX + commentId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long toggleCommentUnLike(Long commentId, Long userId) {
|
||||||
|
return executeToggle(COMMENT_UN_LIKE_KEY_PREFIX + commentId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCommentLikesCount(Long commentId) {
|
||||||
|
return redisTemplate.opsForSet().size(COMMENT_LIKE_KEY_PREFIX + commentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getCommentUnLikesCount(Long commentId) {
|
||||||
|
return redisTemplate.opsForSet().size(COMMENT_UN_LIKE_KEY_PREFIX + commentId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long toggleReplyLike(Long replyId, Long userId) {
|
||||||
|
return executeToggle(COMMENT_REPLY_LIKE_KEY_PREFIX + replyId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long toggleReplyUnLike(Long replyId, Long userId) {
|
||||||
|
return executeToggle(COMMENT_REPLY_UN_LIKE_KEY_PREFIX + replyId, userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getReplyLikesCount(Long replyId) {
|
||||||
|
return redisTemplate.opsForSet().size(COMMENT_REPLY_LIKE_KEY_PREFIX + replyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getReplyUnLikesCount(Long replyId) {
|
||||||
|
return redisTemplate.opsForSet().size(COMMENT_REPLY_UN_LIKE_KEY_PREFIX + replyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long executeToggle(String key, Long userId) {
|
||||||
|
return redisTemplate.execute(toggleLikeScript, Collections.singletonList(key), userId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.java2nb.novel.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.java2nb.novel.core.serialize.CommentUserNameSerialize;
|
||||||
|
import com.java2nb.novel.core.serialize.TimeAgoFormatSerialize;
|
||||||
|
import com.java2nb.novel.entity.BookCommentReply;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author 11797
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class BookCommentReplyVO extends BookCommentReply {
|
||||||
|
|
||||||
|
@JsonSerialize(using = CommentUserNameSerialize.class)
|
||||||
|
private String createUserName;
|
||||||
|
|
||||||
|
private String createUserPhoto;
|
||||||
|
|
||||||
|
@JsonSerialize(using = TimeAgoFormatSerialize.class)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
private Long likesCount;
|
||||||
|
|
||||||
|
private Long unLikesCount;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return super.toString();
|
||||||
|
}
|
||||||
|
}
|
@ -1,8 +1,9 @@
|
|||||||
package com.java2nb.novel.vo;
|
package com.java2nb.novel.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
import com.java2nb.novel.core.serialize.CommentUserNameSerialize;
|
import com.java2nb.novel.core.serialize.CommentUserNameSerialize;
|
||||||
|
import com.java2nb.novel.core.serialize.TimeAgoFormatSerialize;
|
||||||
|
import com.java2nb.novel.core.utils.DateUtil;
|
||||||
import com.java2nb.novel.entity.BookComment;
|
import com.java2nb.novel.entity.BookComment;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@ -19,9 +20,17 @@ public class BookCommentVO extends BookComment {
|
|||||||
|
|
||||||
private String createUserPhoto;
|
private String createUserPhoto;
|
||||||
|
|
||||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonSerialize(using = TimeAgoFormatSerialize.class)
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
private Long likesCount;
|
||||||
|
|
||||||
|
private Long unLikesCount;
|
||||||
|
|
||||||
|
public String getCreateTimeFormat() {
|
||||||
|
return DateUtil.formatTimeAgo(getCreateTime());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return super.toString();
|
return super.toString();
|
||||||
|
@ -23,7 +23,7 @@ xss:
|
|||||||
# 排除链接(多个用逗号分隔)
|
# 排除链接(多个用逗号分隔)
|
||||||
excludes: /system/notice/*
|
excludes: /system/notice/*
|
||||||
# 匹配链接 (多个用逗号分隔)
|
# 匹配链接 (多个用逗号分隔)
|
||||||
urlPatterns: /book/addBookComment,/user/addFeedBack,/author/addBook,/author/addBookContent,/author/updateBookContent,/author/register.html
|
urlPatterns: /book/addCommentReply,/book/addBookComment,/user/addFeedBack,/author/addBook,/author/addBookContent,/author/updateBookContent,/author/register.html
|
||||||
|
|
||||||
|
|
||||||
author:
|
author:
|
||||||
|
BIN
novel-front/src/main/resources/ip2region.xdb
Normal file
BIN
novel-front/src/main/resources/ip2region.xdb
Normal file
Binary file not shown.
@ -4,7 +4,7 @@
|
|||||||
<mapper namespace="com.java2nb.novel.mapper.FrontBookCommentMapper">
|
<mapper namespace="com.java2nb.novel.mapper.FrontBookCommentMapper">
|
||||||
|
|
||||||
<select id="listCommentByPage" resultType="com.java2nb.novel.vo.BookCommentVO">
|
<select id="listCommentByPage" resultType="com.java2nb.novel.vo.BookCommentVO">
|
||||||
select t1.id,t1.book_id,t1.comment_content,t1.reply_count,t1.create_time,t2.username create_user_name,t2.user_photo create_user_photo
|
select t1.id,t1.book_id,t1.comment_content,t1.location,t1.reply_count,t1.create_time,t2.username create_user_name,t2.user_photo create_user_photo
|
||||||
from book_comment t1 inner join user t2 on t1.create_user_id = t2.id
|
from book_comment t1 inner join user t2 on t1.create_user_id = t2.id
|
||||||
<trim>
|
<trim>
|
||||||
<if test="bookId != null">
|
<if test="bookId != null">
|
||||||
@ -19,5 +19,12 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<update id="addReplyCount" parameterType="long">
|
||||||
|
update book_comment
|
||||||
|
set reply_count = reply_count + 1
|
||||||
|
where id = #{commentId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
|
<mapper namespace="com.java2nb.novel.mapper.FrontBookCommentReplyMapper">
|
||||||
|
|
||||||
|
<select id="listCommentReplyByPage" resultType="com.java2nb.novel.vo.BookCommentReplyVO">
|
||||||
|
select t1.id,t1.reply_content,t1.location,t1.create_time,t2.username create_user_name,t2.user_photo create_user_photo
|
||||||
|
from book_comment_reply t1 inner join user t2 on t1.create_user_id = t2.id
|
||||||
|
<trim>
|
||||||
|
<if test="commentId != null">
|
||||||
|
and t1.comment_id = #{commentId}
|
||||||
|
</if>
|
||||||
|
<if test="userId != null">
|
||||||
|
and t1.create_user_id = #{userId}
|
||||||
|
</if>
|
||||||
|
</trim>
|
||||||
|
order by t1.create_time desc
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
@ -964,4 +964,14 @@ i.vip_b {
|
|||||||
|
|
||||||
.userBox {
|
.userBox {
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.layui-elem-quote {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 15px;
|
||||||
|
line-height: 1.8;
|
||||||
|
border-left: 5px solid #16b777;
|
||||||
|
border-radius: 0 2px 2px 0;
|
||||||
|
background-color: #fafafa;
|
||||||
}
|
}
|
@ -91,7 +91,7 @@
|
|||||||
},
|
},
|
||||||
SaveComment: function (cmtBId, cmtCId, cmtDetail) {
|
SaveComment: function (cmtBId, cmtCId, cmtDetail) {
|
||||||
if (!isLogin) {
|
if (!isLogin) {
|
||||||
layer.alert('请先登陆');
|
layer.alert('请先登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
||||||
@ -133,6 +133,52 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
SaveCommentReply: function (cmtBId, cmtCId, cmtDetail) {
|
||||||
|
if (!isLogin) {
|
||||||
|
layer.alert('请先登录');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
||||||
|
if (cmtDetailTemp == '') {
|
||||||
|
layer.alert('回复内容必须填写');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmtDetailTemp.length < 5) {
|
||||||
|
layer.alert('回复内容必须大于5个字');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmtDetail.length < 5) {
|
||||||
|
layer.alert('回复内容必须大于5个字');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "/book/addCommentReply",
|
||||||
|
data: {'commentId': $("#commentId").val(), 'replyContent': cmtDetail},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$('#txtComment').val("")
|
||||||
|
layer.alert('回复成功!');
|
||||||
|
loadCommentList(1, 20);
|
||||||
|
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
GetFavoritesBook: function (BId) {
|
GetFavoritesBook: function (BId) {
|
||||||
},
|
},
|
||||||
|
@ -273,7 +273,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -114,9 +114,9 @@
|
|||||||
$('#txtComment').val($('#txtComment').val().substring(0, 1000));
|
$('#txtComment').val($('#txtComment').val().substring(0, 1000));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
searchComments(1, 20);
|
loadCommentList(1, 20);
|
||||||
|
|
||||||
function searchComments(curr, limit) {
|
function loadCommentList(curr, limit) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
@ -135,12 +135,15 @@
|
|||||||
"<div class=\"user_heads fl\" vals=\"389\">" +
|
"<div class=\"user_heads fl\" vals=\"389\">" +
|
||||||
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
|
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
|
||||||
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
||||||
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName.substr(0, 4) + "****" + comment.createUserName.substr(comment.createUserName.length - 3, 3))+"</li><li class=\"dec\">" +
|
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName)+"<span style='padding-left: 10px' class=\"other\">"+(comment.location ? comment.location + "读者" : '')+"</span></li><li class=\"dec\">" +
|
||||||
comment.commentContent+
|
comment.commentContent+
|
||||||
"</li><li class=\"other cf\">" +
|
"</li><li class=\"other cf\">" +
|
||||||
"<span class=\"time fl\">"+comment.createTime+"</span>" +
|
"<span class=\"time fl\">"+comment.createTime+"</span>" +
|
||||||
"<span class=\"fr\"><a href=\"javascript:void(0);\" onclick=\"javascript:BookDetail.AddAgreeTotal(77,this);\" class=\"zan\" style=\"display: none;\">赞<i class=\"num\">(0)</i></a>" +
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentUnLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">踩<i class=\"num\" id='unLikeCount"+comment.id+"'>("+comment.unLikesCount+")</i></a></span>" +
|
||||||
"</span></li>\t\t</ul>\t</div>");
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">赞<i class=\"num\" id='likeCount"+comment.id+"'>("+comment.likesCount+")</i></a></span>" +
|
||||||
|
"<span class=\"fr\"><a href=\"/book/reply-"+comment.id+".html\" class=\"zan\" style=\"padding-left: 10px\">回复<i class=\"num\">("+comment.replyCount+
|
||||||
|
")</i></a></span>" +
|
||||||
|
"</li>\t\t</ul>\t</div>");
|
||||||
}
|
}
|
||||||
$("#commentPanel").html(commentListHtml);
|
$("#commentPanel").html(commentListHtml);
|
||||||
|
|
||||||
@ -185,6 +188,56 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleCommentLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#likeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCommentUnLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentUnLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#unLikeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -0,0 +1,216 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||||||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head th:replace="common/header :: common_head(~{::title},~{},~{::link},~{})">
|
||||||
|
<title th:text="'评论回复区'"></title>
|
||||||
|
<link href="/css/main.css" rel="stylesheet"/>
|
||||||
|
<link href="/css/book.css" rel="stylesheet"/>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<input type="hidden" id="commentId" th:value="${commentId}"/>
|
||||||
|
|
||||||
|
<div th:replace="common/top :: top('')">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="main box_center cf mb50">
|
||||||
|
<div class="channelBookContent cf">
|
||||||
|
<!--left start-->
|
||||||
|
<div class="wrap_left fl">
|
||||||
|
<div class="wrap_bg">
|
||||||
|
<div class="pad20">
|
||||||
|
|
||||||
|
<div class="bookComment">
|
||||||
|
<div class="book_tit">
|
||||||
|
<div class="fl">
|
||||||
|
<h3>评论回复区</h3><span id="bookCommentTotal">(0条)</span>
|
||||||
|
</div>
|
||||||
|
<a class="fr" href="#txtComment">发表回复</a>
|
||||||
|
</div>
|
||||||
|
<blockquote class="layui-elem-quote" th:utext="${commentContent}">
|
||||||
|
</blockquote>
|
||||||
|
<div class="no_comment" id="noCommentPanel" style="display: none;">
|
||||||
|
<img src="/images/no_comment.png" alt=""/>
|
||||||
|
<span class="block">暂无回复</span>
|
||||||
|
</div>
|
||||||
|
<div class="commentBar" id="commentPanel">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<div class="pageBox cf mt15 mr10" id="commentPage">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="reply_bar" id="reply_bar">
|
||||||
|
<div class="tit">
|
||||||
|
<span class="fl font16">发表回复</span>
|
||||||
|
<!--未登录状态下不可发表评论,显示以下链接-->
|
||||||
|
<span class="fr black9" style="display:none; ">请先 <a class="orange"
|
||||||
|
href="/user/login.html">登录</a><em
|
||||||
|
class="ml10 mr10">|</em><a class="orange"
|
||||||
|
href="/user/register.html">注册</a></span>
|
||||||
|
</div>
|
||||||
|
<textarea name="txtComment" rows="2" cols="20" id="txtComment" class="replay_text"
|
||||||
|
placeholder="我来说两句..."></textarea>
|
||||||
|
<div class="reply_btn">
|
||||||
|
<span class="fl black9"><em class="ml5" id="emCommentNum">0/1000</em> 字</span>
|
||||||
|
<span class="fr"><a class="btn_ora" href="javascript:void(0);"
|
||||||
|
onclick="javascript:BookDetail.SaveCommentReply(37,0,$('#txtComment').val());">发表</a></span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!--left end-->
|
||||||
|
|
||||||
|
<!--right start-->
|
||||||
|
|
||||||
|
<!--right end-->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div th:replace="common/footer :: footer">
|
||||||
|
</div>
|
||||||
|
<div th:replace="common/js :: js"></div>
|
||||||
|
<script src="/javascript/bookdetail.js" type="text/javascript"></script>
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
$('#txtComment').on('input propertychange', function () {
|
||||||
|
var count = $(this).val().length;
|
||||||
|
$('#emCommentNum').html(count + "/1000");
|
||||||
|
if (count > 1000) {
|
||||||
|
$('#txtComment').val($('#txtComment').val().substring(0, 1000));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
loadCommentList(1, 20);
|
||||||
|
|
||||||
|
function loadCommentList(curr, limit) {
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "get",
|
||||||
|
url: "/book/listCommentReplyByPage",
|
||||||
|
data: {'commentId': $("#commentId").val(), 'curr': curr, 'limit': limit},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
if (data.data.total == 0) {
|
||||||
|
$("#noCommentPanel").css("display", "block");
|
||||||
|
$("#commentPanel").css("display", "none");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$("#noCommentPanel").css("display", "none");
|
||||||
|
$("#commentPanel").css("display", "block");
|
||||||
|
var commentList = data.data.list;
|
||||||
|
if (commentList.length > 0) {
|
||||||
|
$("#bookCommentTotal").html("(" + data.data.total + "条)");
|
||||||
|
var commentListHtml = "";
|
||||||
|
for (var i = 0; i < commentList.length; i++) {
|
||||||
|
var comment = commentList[i];
|
||||||
|
commentListHtml += ("<div class=\"comment_list cf\">" +
|
||||||
|
"<div class=\"user_heads fl\" vals=\"389\">" +
|
||||||
|
"<img src=\"" + (comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png') + "\" class=\"user_head\" alt=\"\">" +
|
||||||
|
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
||||||
|
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">" + (comment.createUserName) + "<span style='padding-left: 10px' class=\"other\">" + (comment.location ? comment.location + "读者" : '') + "</span></li><li class=\"dec\">" +
|
||||||
|
comment.replyContent +
|
||||||
|
"</li><li class=\"other cf\">" +
|
||||||
|
"<span class=\"time fl\" style='padding-right: 10px'>" + (data.data.total - ((curr - 1) * limit + i)) + "楼</span>" +
|
||||||
|
"<span class=\"time fl\">" + comment.createTime + "</span>" +
|
||||||
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentUnLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">踩<i class=\"num\" id='unLikeCount"+comment.id+"'>("+comment.unLikesCount+")</i></a></span>" +
|
||||||
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">赞<i class=\"num\" id='likeCount"+comment.id+"'>("+comment.likesCount+")</i></a></span>" +
|
||||||
|
"</li>\t\t</ul>\t</div>");
|
||||||
|
}
|
||||||
|
$("#commentPanel").html(commentListHtml);
|
||||||
|
|
||||||
|
layui.use('laypage', function () {
|
||||||
|
var laypage = layui.laypage;
|
||||||
|
|
||||||
|
//执行一个laypage实例
|
||||||
|
laypage.render({
|
||||||
|
elem: 'commentPage' //注意,这里的 test1 是 ID,不用加 # 号
|
||||||
|
, count: data.data.total //数据总数,从服务端得到,
|
||||||
|
, curr: data.data.pageNum
|
||||||
|
, limit: data.data.pageSize
|
||||||
|
, jump: function (obj, first) {
|
||||||
|
|
||||||
|
|
||||||
|
//obj包含了当前分页的所有参数,比如:
|
||||||
|
console.log(obj.curr); //得到当前页,以便向服务端请求对应页的数据。
|
||||||
|
console.log(obj.limit); //得到每页显示的条数
|
||||||
|
|
||||||
|
|
||||||
|
//首次不执行
|
||||||
|
if (!first) {
|
||||||
|
loadCommentList(obj.curr, obj.limit);
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCommentLike(replyId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleReplyLike",
|
||||||
|
data: {'replyId': replyId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#likeCount"+replyId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCommentUnLike(replyId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleReplyUnLike",
|
||||||
|
data: {'replyId': replyId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#unLikeCount"+replyId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -22,21 +22,23 @@
|
|||||||
|
|
||||||
<div class="main box_center cf mb50">
|
<div class="main box_center cf mb50">
|
||||||
<div class="nav_sub">
|
<div class="nav_sub">
|
||||||
<a href="/" th:text="${application.website.name}"></a>><a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>><a
|
<a href="/" th:text="${application.website.name}"></a>><a th:href="'/book/bookclass.html?c='+${book.catId}"
|
||||||
|
th:text="${book.catName}"></a>><a
|
||||||
th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}"></a>
|
th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="channelWrap channelBookInfo cf">
|
<div class="channelWrap channelBookInfo cf">
|
||||||
<div class="bookCover cf">
|
<div class="bookCover cf">
|
||||||
<a th:href="${book.picUrl}" class="book_cover"><img class="cover" th:src="${book.picUrl}"
|
<a th:href="${book.picUrl}" class="book_cover"><img class="cover" th:src="${book.picUrl}"
|
||||||
th:attr="alt=${book.bookName}"/></a>
|
th:attr="alt=${book.bookName}"/></a>
|
||||||
<div class="book_info">
|
<div class="book_info">
|
||||||
<div class="tit">
|
<div class="tit">
|
||||||
<h1 th:utext="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>--><a class="author"
|
<h1 th:utext="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>--><a class="author"
|
||||||
th:utext="${book.authorName}+' 著'"></a>
|
th:utext="${book.authorName}+' 著'"></a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><span class="item">类别:<em th:text="${book.catName}"></em></span>
|
<li><span class="item">类别:<em th:text="${book.catName}"></em></span>
|
||||||
<span class="item" th:switch="${book.bookStatus}">状态:<em th:case="'0'">连载中</em><em th:case="*">已完结</em></span>
|
<span class="item" th:switch="${book.bookStatus}">状态:<em th:case="'0'">连载中</em><em
|
||||||
|
th:case="*">已完结</em></span>
|
||||||
<span class="item">总点击:<em id="cTotal" th:text="${book.visitCount}"></em></span>
|
<span class="item">总点击:<em id="cTotal" th:text="${book.visitCount}"></em></span>
|
||||||
<span class="item">总字数:<em th:text="${book.wordCount}"></em></span></li>
|
<span class="item">总字数:<em th:text="${book.wordCount}"></em></span></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -70,7 +72,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul class="list cf">
|
<ul class="list cf">
|
||||||
<li>
|
<li>
|
||||||
<span class="fl font16"> <a th:href="'/book/'+${book.id}+'/'+${book.lastIndexId}+'.html'" th:utext="${book.lastIndexName}"><!--<i class="vip">VIP</i>--></a></span>
|
<span class="fl font16"> <a
|
||||||
|
th:href="'/book/'+${book.id}+'/'+${book.lastIndexId}+'.html'"
|
||||||
|
th:utext="${book.lastIndexName}"><!--<i class="vip">VIP</i>--></a></span>
|
||||||
<span class="black9 fr"
|
<span class="black9 fr"
|
||||||
th:text="'更新时间:'+${#dates.format(book.lastIndexUpdateTime, 'yy/MM/dd HH:mm:ss')}"></span>
|
th:text="'更新时间:'+${#dates.format(book.lastIndexUpdateTime, 'yy/MM/dd HH:mm:ss')}"></span>
|
||||||
</li>
|
</li>
|
||||||
@ -86,21 +90,46 @@
|
|||||||
<div class="bookComment">
|
<div class="bookComment">
|
||||||
<div class="book_tit">
|
<div class="book_tit">
|
||||||
<div class="fl">
|
<div class="fl">
|
||||||
<h3>作品评论区</h3><span id="bookCommentTotal" th:text="'('+${bookCommentPageBean.total}+'条)'"></span>
|
<h3>作品评论区</h3><span id="bookCommentTotal"
|
||||||
|
th:text="'('+${bookCommentPageBean.total}+'条)'"></span>
|
||||||
</div>
|
</div>
|
||||||
<a class="fr" href="#txtComment">发表评论</a>
|
<a class="fr" href="#txtComment">发表评论</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="no_comment" id="noCommentPanel" th:style="${bookCommentPageBean.total > 0}? 'display:none'" >
|
<div class="no_comment" id="noCommentPanel"
|
||||||
|
th:style="${bookCommentPageBean.total > 0}? 'display:none'">
|
||||||
<img src="/images/no_comment.png" alt=""/>
|
<img src="/images/no_comment.png" alt=""/>
|
||||||
<span class="block">暂无评论</span>
|
<span class="block">暂无评论</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="commentBar" id="commentPanel" th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
<div class="commentBar" id="commentPanel"
|
||||||
<div th:each="comment: ${bookCommentPageBean.list}" class="comment_list cf"><div class="user_heads fl" vals="389"><img th:src="${comment.createUserPhoto}?${comment.createUserPhoto}:'/images/man.png'" class="user_head" alt=""><span class="user_level1" style="display: none;">见习</span></div><ul class="pl_bar fr"> <li class="name" th:text="${#strings.substring(comment.createUserName,0,4)}+'****'+${#strings.substring(comment.createUserName,#strings.length(comment.createUserName)-3,#strings.length(comment.createUserName))}"></li><li class="dec" th:utext="${comment.commentContent}"></li><li class="other cf"><span class="time fl" th:text="${#calendars.format(comment.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span><span class="fr"><a href="javascript:void(0);" onclick="javascript:BookDetail.AddAgreeTotal(77,this);" class="zan" style="display: none;">赞<i class="num">(0)</i></a></span></li> </ul> </div>
|
th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
||||||
|
<div th:each="comment: ${bookCommentPageBean.list}" class="comment_list cf">
|
||||||
|
<div class="user_heads fl" vals="389"><img
|
||||||
|
th:src="${comment.createUserPhoto}?${comment.createUserPhoto}:'/images/man.png'"
|
||||||
|
class="user_head" alt=""><span class="user_level1"
|
||||||
|
style="display: none;">见习</span></div>
|
||||||
|
<ul class="pl_bar fr">
|
||||||
|
<li class="name"><span
|
||||||
|
th:text="${#strings.substring(comment.createUserName,0,4)}+'****'+${#strings.substring(comment.createUserName,#strings.length(comment.createUserName)-3,#strings.length(comment.createUserName))}"></span><span
|
||||||
|
style="padding-left: 10px" class="other" th:if="${comment.location}"
|
||||||
|
th:text="${comment.location} + '读者'"></span></span></li>
|
||||||
|
<li class="dec" th:utext="${comment.commentContent}"></li>
|
||||||
|
<li class="other cf"><span class="time fl"
|
||||||
|
th:text="${comment.createTimeFormat}"></span><span
|
||||||
|
class="fr"><a th:href="'javascript:toggleCommentUnLike(\''+${comment.id}+'\')'" onclick="javascript:;" class="zan"
|
||||||
|
style="padding-left: 10px">踩<i class="num" th:id="'unLikeCount'+${comment.id}">([[${comment.unLikesCount}]])</i></a></span><span
|
||||||
|
class="fr"><a th:href="'javascript:toggleCommentLike(\''+${comment.id}+'\')'" class="zan"
|
||||||
|
style="padding-left: 10px">赞<i class="num" th:id="'likeCount'+${comment.id}">([[${comment.likesCount}]])</i></a></span><span
|
||||||
|
class="fr"><a th:href="'/book/reply-'+${comment.id}+'.html'" class="zan"
|
||||||
|
style="padding-left: 10px">回复<i class="num">([[${comment.replyCount}]])</i></a></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--无评论时此处隐藏-->
|
<!--无评论时此处隐藏-->
|
||||||
<div class="more_bar" id="moreCommentPanel" th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
<div class="more_bar" id="moreCommentPanel"
|
||||||
|
th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
||||||
<a th:href="'/book/comment-'+${book.id}+'.html'">查看全部评论></a>
|
<a th:href="'/book/comment-'+${book.id}+'.html'">查看全部评论></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -109,7 +138,7 @@
|
|||||||
<span class="fl font16">发表评论</span>
|
<span class="fl font16">发表评论</span>
|
||||||
<!--未登录状态下不可发表评论,显示以下链接-->
|
<!--未登录状态下不可发表评论,显示以下链接-->
|
||||||
<span class="fr black9" style="display:none; ">请先 <a class="orange"
|
<span class="fr black9" style="display:none; ">请先 <a class="orange"
|
||||||
href="/user/login.html">登录</a><em
|
href="/user/login.html">登录</a><em
|
||||||
class="ml10 mr10">|</em><a class="orange"
|
class="ml10 mr10">|</em><a class="orange"
|
||||||
href="/user/register.html">注册</a></span>
|
href="/user/register.html">注册</a></span>
|
||||||
</div>
|
</div>
|
||||||
@ -175,10 +204,12 @@
|
|||||||
<li th:each="book : ${recBooks}">
|
<li th:each="book : ${recBooks}">
|
||||||
<div class="book_intro">
|
<div class="book_intro">
|
||||||
<div class="cover">
|
<div class="cover">
|
||||||
<a th:href="'/book/'+${book.id}+'.html'"><img th:src="${book.picUrl}" th:alt="${book.bookName}"></a>
|
<a th:href="'/book/'+${book.id}+'.html'"><img th:src="${book.picUrl}"
|
||||||
|
th:alt="${book.bookName}"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="dec">
|
<div class="dec">
|
||||||
<a class="book_name" th:href="'/book/'+${book.id}+'.html'" th:text="${book.bookName}"></a>
|
<a class="book_name" th:href="'/book/'+${book.id}+'.html'"
|
||||||
|
th:text="${book.bookName}"></a>
|
||||||
<a class="txt" th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookDesc}">
|
<a class="txt" th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookDesc}">
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
@ -210,7 +241,7 @@
|
|||||||
var bookId = pathname.substring(pathname.lastIndexOf("/") + 1, pathname.lastIndexOf("."))
|
var bookId = pathname.substring(pathname.lastIndexOf("/") + 1, pathname.lastIndexOf("."))
|
||||||
//查询章节信息
|
//查询章节信息
|
||||||
var lastBookIndexId = $("#lastBookIndexId").val();
|
var lastBookIndexId = $("#lastBookIndexId").val();
|
||||||
if(lastBookIndexId){
|
if (lastBookIndexId) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/book/queryBookIndexAbout",
|
url: "/book/queryBookIndexAbout",
|
||||||
@ -232,7 +263,7 @@
|
|||||||
layer.alert('网络异常');
|
layer.alert('网络异常');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
$("#optBtn").remove();
|
$("#optBtn").remove();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -264,9 +295,6 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var currentBId = 37, spmymoney = 0;
|
var currentBId = 37, spmymoney = 0;
|
||||||
var relationStep = 0;
|
var relationStep = 0;
|
||||||
var authorUId = 8;
|
var authorUId = 8;
|
||||||
@ -283,7 +311,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("#AuthorOtherNovel li").unbind("mouseover");
|
$("#AuthorOtherNovel li").unbind("mouseover");
|
||||||
|
|
||||||
$('#txtComment').on('input propertychange', function () {
|
$('#txtComment').on('input propertychange', function () {
|
||||||
@ -301,7 +328,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function loadCommentList(){
|
function loadCommentList() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/book/listCommentByPage",
|
url: "/book/listCommentByPage",
|
||||||
@ -311,20 +338,25 @@
|
|||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
var commentList = data.data.list;
|
var commentList = data.data.list;
|
||||||
if (commentList.length > 0) {
|
if (commentList.length > 0) {
|
||||||
$("#bookCommentTotal").html("("+data.data.total+"条)");
|
$("#bookCommentTotal").html("(" + data.data.total + "条)");
|
||||||
var commentListHtml = "";
|
var commentListHtml = "";
|
||||||
for (var i = 0; i < commentList.length; i++) {
|
for (var i = 0; i < commentList.length; i++) {
|
||||||
var comment = commentList[i];
|
var comment = commentList[i];
|
||||||
commentListHtml += ("<div class=\"comment_list cf\">" +
|
commentListHtml += ("<div class=\"comment_list cf\">" +
|
||||||
"<div class=\"user_heads fl\" vals=\"389\">" +
|
"<div class=\"user_heads fl\" vals=\"389\">" +
|
||||||
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
|
"<img src=\"" + (comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png') + "\" class=\"user_head\" alt=\"\">" +
|
||||||
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
||||||
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName)+"</li><li class=\"dec\">" +
|
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">" + (comment.createUserName) + "<span style='padding-left: 10px' class=\"other\">" + (comment.location ? comment.location + "读者" : '') + "</span></li><li class=\"dec\">" +
|
||||||
comment.commentContent+
|
comment.commentContent +
|
||||||
"</li><li class=\"other cf\">" +
|
"</li><li class=\"other cf\">" +
|
||||||
"<span class=\"time fl\">"+comment.createTime+"</span>" +
|
"<span class=\"time fl\">" + comment.createTime + "</span>" +
|
||||||
"<span class=\"fr\"><a href=\"javascript:void(0);\" onclick=\"javascript:BookDetail.AddAgreeTotal(77,this);\" class=\"zan\" style=\"display: none;\">赞<i class=\"num\">(0)</i></a>" +
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentUnLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">踩<i class=\"num\" id='unLikeCount"+comment.id+"'>("+comment.unLikesCount+")</i></a></span>" +
|
||||||
"</span></li>\t\t</ul>\t</div>");
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">赞<i class=\"num\" id='likeCount"+comment.id+"'>("+comment.likesCount+")</i></a></span>" +
|
||||||
|
"<span class=\"fr\"><a href=\"/book/reply-"+comment.id+".html\" class=\"zan\" style=\"padding-left: 10px\">回复<i class=\"num\">("+comment.replyCount+
|
||||||
|
")</i></a></span>" +
|
||||||
|
"</li>\t\t</ul>\t</div>"
|
||||||
|
)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
$("#commentPanel").html(commentListHtml);
|
$("#commentPanel").html(commentListHtml);
|
||||||
$("#noCommentPanel").hide();
|
$("#noCommentPanel").hide();
|
||||||
@ -348,6 +380,55 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function toggleCommentLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#likeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCommentUnLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentUnLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#unLikeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="userBox cf">
|
<div class="userBox cf">
|
||||||
<div class="user_l">
|
<div class="user_l">
|
||||||
<form method="post" action="./login.html" id="form1">
|
<form method="post" action="./login.html" id="form1">
|
||||||
<h3 th:text="'登陆'+${application.website.name}"></h3>
|
<h3 th:text="'登录'+${application.website.name}"></h3>
|
||||||
<ul class="log_list">
|
<ul class="log_list">
|
||||||
<li><span id="LabErr"></span></li>
|
<li><span id="LabErr"></span></li>
|
||||||
<li><input name="txtUName" type="text" id="txtUName" placeholder="手机号码" class="s_input icon_name" /></li>
|
<li><input name="txtUName" type="text" id="txtUName" placeholder="手机号码" class="s_input icon_name" /></li>
|
||||||
|
2
pom.xml
2
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<version>5.1.3</version>
|
<version>5.2.1</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>novel-common</module>
|
<module>novel-common</module>
|
||||||
<module>novel-front</module>
|
<module>novel-front</module>
|
||||||
|
@ -260,7 +260,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -260,7 +260,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -51,8 +51,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="my_r">
|
<div class="my_r">
|
||||||
<div id="noContentDiv">
|
<div id="noContentDiv">
|
||||||
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a>
|
<div class="tc" style="margin-top: 200px"><a href="/author/book_add.html" class="btn_red">创建作品</a></div>
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="my_bookshelf" id="hasContentDiv" style="display: none">
|
<div class="my_bookshelf" id="hasContentDiv" style="display: none">
|
||||||
@ -143,13 +142,12 @@
|
|||||||
<script src="/javascript/common.js" type="text/javascript"></script>
|
<script src="/javascript/common.js" type="text/javascript"></script>
|
||||||
|
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
var searchCount = 0;
|
var coverUpdateInterval;
|
||||||
var timeout;
|
|
||||||
search(1, 5);
|
search(1, 5);
|
||||||
|
|
||||||
function search(curr, limit) {
|
function search(curr, limit) {
|
||||||
searchCount++;
|
clearInterval(coverUpdateInterval);
|
||||||
clearTimeout(timeout);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/author/listBookByPage",
|
url: "/author/listBookByPage",
|
||||||
@ -159,7 +157,25 @@
|
|||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
var bookList = data.data.list;
|
var bookList = data.data.list;
|
||||||
if (bookList.length > 0) {
|
if (bookList.length > 0) {
|
||||||
var aiPicGenerating = bookList[0].picUrl == '/images/default.gif'
|
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");
|
$("#hasContentDiv").css("display", "block");
|
||||||
$("#noContentDiv").css("display", "none");
|
$("#noContentDiv").css("display", "none");
|
||||||
var bookListHtml = "";
|
var bookListHtml = "";
|
||||||
@ -171,15 +187,12 @@
|
|||||||
" </td>\n" +*/
|
" </td>\n" +*/
|
||||||
|
|
||||||
" <td style=\"position: relative\" class=\"goread\">\n" +
|
" <td style=\"position: relative\" class=\"goread\">\n" +
|
||||||
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "'," + i + ")\"\n" +
|
"<input class=\"opacity\" onchange=\"picChange('" + book.id + "')\"\n" +
|
||||||
" type=\"file\" id=\"file" + i + "\" name=\"file\"\n" +
|
" type=\"file\" id=\"file" + book.id + "\" name=\"file\"\n" +
|
||||||
" title=\"点击上传图片\"\n" +
|
" title=\"点击上传图片\"\n" +
|
||||||
" style=\"z-index: 100;cursor: pointer;left: 30px; top: 0px; width: 60px; height: 80px; opacity: 0; position: absolute; \"\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/>" +
|
"<img id=\"cover" + book.id + "\" width='50' height='70' src='" + book.picUrl + "'/><br/>" + " " + book.bookName + "</td>\n" +
|
||||||
" " + book.bookName + "</td>\n" +
|
|
||||||
|
|
||||||
|
|
||||||
" <td class=\"goread\" >"
|
" <td class=\"goread\" >"
|
||||||
+ book.catName + "</td>\n" +
|
+ book.catName + "</td>\n" +
|
||||||
|
|
||||||
@ -231,12 +244,6 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
if (curr === 1 && aiPicGenerating && searchCount < 10) {
|
|
||||||
timeout = setTimeout(function () {
|
|
||||||
search(curr, limit);
|
|
||||||
}, 3000);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -288,19 +295,20 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function picChange(bookId, i) {
|
function picChange(bookId) {
|
||||||
var file = $("#file" + i).val(); //文件名称
|
var file = $("#file" + bookId).val(); //文件名称
|
||||||
if (file != "") {
|
if (file != "") {
|
||||||
if (checkPicUpload($("#file" + i)[0])) {
|
if (checkPicUpload($("#file" + bookId)[0])) {
|
||||||
|
|
||||||
$.ajaxFileUpload({
|
$.ajaxFileUpload({
|
||||||
url: "/file/picUpload", //用于文件上传的服务器端请求地址
|
url: "/file/picUpload", //用于文件上传的服务器端请求地址
|
||||||
secureuri: false, //是否需要安全协议,一般设置为false
|
secureuri: false, //是否需要安全协议,一般设置为false
|
||||||
fileElementId: "file" + i, //文件上传域的ID
|
fileElementId: "file" + bookId, //文件上传域的ID
|
||||||
dataType: "json", //返回值类型 一般设置为json
|
dataType: "json", //返回值类型 一般设置为json
|
||||||
type: "post",
|
type: "post",
|
||||||
success: function (data) { //服务器成功响应处理函数
|
success: function (data) { //服务器成功响应处理函数
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
|
let picUrl = data.data;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "/author/updateBookPic",
|
url: "/author/updateBookPic",
|
||||||
@ -308,17 +316,13 @@
|
|||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
|
$("#cover"+bookId).attr("src", picUrl);
|
||||||
location.reload();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
lock = false;
|
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function () {
|
error: function () {
|
||||||
lock = false;
|
|
||||||
layer.alert('网络异常');
|
layer.alert('网络异常');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -273,7 +273,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -114,9 +114,9 @@
|
|||||||
$('#txtComment').val($('#txtComment').val().substring(0, 1000));
|
$('#txtComment').val($('#txtComment').val().substring(0, 1000));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
searchComments(1, 20);
|
loadCommentList(1, 20);
|
||||||
|
|
||||||
function searchComments(curr, limit) {
|
function loadCommentList(curr, limit) {
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
@ -135,12 +135,15 @@
|
|||||||
"<div class=\"user_heads fl\" vals=\"389\">" +
|
"<div class=\"user_heads fl\" vals=\"389\">" +
|
||||||
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
|
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
|
||||||
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
||||||
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName.substr(0, 4) + "****" + comment.createUserName.substr(comment.createUserName.length - 3, 3))+"</li><li class=\"dec\">" +
|
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName)+"<span style='padding-left: 10px' class=\"other\">"+(comment.location ? comment.location + "读者" : '')+"</span></li><li class=\"dec\">" +
|
||||||
comment.commentContent+
|
comment.commentContent+
|
||||||
"</li><li class=\"other cf\">" +
|
"</li><li class=\"other cf\">" +
|
||||||
"<span class=\"time fl\">"+comment.createTime+"</span>" +
|
"<span class=\"time fl\">"+comment.createTime+"</span>" +
|
||||||
"<span class=\"fr\"><a href=\"javascript:void(0);\" onclick=\"javascript:BookDetail.AddAgreeTotal(77,this);\" class=\"zan\" style=\"display: none;\">赞<i class=\"num\">(0)</i></a>" +
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentUnLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">踩<i class=\"num\" id='unLikeCount"+comment.id+"'>("+comment.unLikesCount+")</i></a></span>" +
|
||||||
"</span></li>\t\t</ul>\t</div>");
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">赞<i class=\"num\" id='likeCount"+comment.id+"'>("+comment.likesCount+")</i></a></span>" +
|
||||||
|
"<span class=\"fr\"><a href=\"/book/reply-"+comment.id+".html\" class=\"zan\" style=\"padding-left: 10px\">回复<i class=\"num\">("+comment.replyCount+
|
||||||
|
")</i></a></span>" +
|
||||||
|
"</li>\t\t</ul>\t</div>");
|
||||||
}
|
}
|
||||||
$("#commentPanel").html(commentListHtml);
|
$("#commentPanel").html(commentListHtml);
|
||||||
|
|
||||||
@ -185,6 +188,56 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleCommentLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#likeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCommentUnLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentUnLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#unLikeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -22,21 +22,23 @@
|
|||||||
|
|
||||||
<div class="main box_center cf mb50">
|
<div class="main box_center cf mb50">
|
||||||
<div class="nav_sub">
|
<div class="nav_sub">
|
||||||
<a href="/" th:text="${application.website.name}"></a>><a th:href="'/book/bookclass.html?c='+${book.catId}" th:text="${book.catName}"></a>><a
|
<a href="/" th:text="${application.website.name}"></a>><a th:href="'/book/bookclass.html?c='+${book.catId}"
|
||||||
|
th:text="${book.catName}"></a>><a
|
||||||
th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}"></a>
|
th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookName}"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="channelWrap channelBookInfo cf">
|
<div class="channelWrap channelBookInfo cf">
|
||||||
<div class="bookCover cf">
|
<div class="bookCover cf">
|
||||||
<a th:href="${book.picUrl}" class="book_cover"><img class="cover" th:src="${book.picUrl}"
|
<a th:href="${book.picUrl}" class="book_cover"><img class="cover" th:src="${book.picUrl}"
|
||||||
th:attr="alt=${book.bookName}"/></a>
|
th:attr="alt=${book.bookName}"/></a>
|
||||||
<div class="book_info">
|
<div class="book_info">
|
||||||
<div class="tit">
|
<div class="tit">
|
||||||
<h1 th:utext="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>--><a class="author"
|
<h1 th:utext="${book.bookName}"></h1><!--<i class="vip_b">VIP</i>--><a class="author"
|
||||||
th:utext="${book.authorName}+' 著'"></a>
|
th:utext="${book.authorName}+' 著'"></a>
|
||||||
</div>
|
</div>
|
||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li><span class="item">类别:<em th:text="${book.catName}"></em></span>
|
<li><span class="item">类别:<em th:text="${book.catName}"></em></span>
|
||||||
<span class="item" th:switch="${book.bookStatus}">状态:<em th:case="'0'">连载中</em><em th:case="*">已完结</em></span>
|
<span class="item" th:switch="${book.bookStatus}">状态:<em th:case="'0'">连载中</em><em
|
||||||
|
th:case="*">已完结</em></span>
|
||||||
<span class="item">总点击:<em id="cTotal" th:text="${book.visitCount}"></em></span>
|
<span class="item">总点击:<em id="cTotal" th:text="${book.visitCount}"></em></span>
|
||||||
<span class="item">总字数:<em th:text="${book.wordCount}"></em></span></li>
|
<span class="item">总字数:<em th:text="${book.wordCount}"></em></span></li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -70,7 +72,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul class="list cf">
|
<ul class="list cf">
|
||||||
<li>
|
<li>
|
||||||
<span class="fl font16"> <a th:href="'/book/'+${book.id}+'/'+${book.lastIndexId}+'.html'" th:utext="${book.lastIndexName}"><!--<i class="vip">VIP</i>--></a></span>
|
<span class="fl font16"> <a
|
||||||
|
th:href="'/book/'+${book.id}+'/'+${book.lastIndexId}+'.html'"
|
||||||
|
th:utext="${book.lastIndexName}"><!--<i class="vip">VIP</i>--></a></span>
|
||||||
<span class="black9 fr"
|
<span class="black9 fr"
|
||||||
th:text="'更新时间:'+${#dates.format(book.lastIndexUpdateTime, 'yy/MM/dd HH:mm:ss')}"></span>
|
th:text="'更新时间:'+${#dates.format(book.lastIndexUpdateTime, 'yy/MM/dd HH:mm:ss')}"></span>
|
||||||
</li>
|
</li>
|
||||||
@ -86,21 +90,46 @@
|
|||||||
<div class="bookComment">
|
<div class="bookComment">
|
||||||
<div class="book_tit">
|
<div class="book_tit">
|
||||||
<div class="fl">
|
<div class="fl">
|
||||||
<h3>作品评论区</h3><span id="bookCommentTotal" th:text="'('+${bookCommentPageBean.total}+'条)'"></span>
|
<h3>作品评论区</h3><span id="bookCommentTotal"
|
||||||
|
th:text="'('+${bookCommentPageBean.total}+'条)'"></span>
|
||||||
</div>
|
</div>
|
||||||
<a class="fr" href="#txtComment">发表评论</a>
|
<a class="fr" href="#txtComment">发表评论</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="no_comment" id="noCommentPanel" th:style="${bookCommentPageBean.total > 0}? 'display:none'" >
|
<div class="no_comment" id="noCommentPanel"
|
||||||
|
th:style="${bookCommentPageBean.total > 0}? 'display:none'">
|
||||||
<img src="/images/no_comment.png" alt=""/>
|
<img src="/images/no_comment.png" alt=""/>
|
||||||
<span class="block">暂无评论</span>
|
<span class="block">暂无评论</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="commentBar" id="commentPanel" th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
<div class="commentBar" id="commentPanel"
|
||||||
<div th:each="comment: ${bookCommentPageBean.list}" class="comment_list cf"><div class="user_heads fl" vals="389"><img th:src="${comment.createUserPhoto}?${comment.createUserPhoto}:'/images/man.png'" class="user_head" alt=""><span class="user_level1" style="display: none;">见习</span></div><ul class="pl_bar fr"> <li class="name" th:text="${#strings.substring(comment.createUserName,0,4)}+'****'+${#strings.substring(comment.createUserName,#strings.length(comment.createUserName)-3,#strings.length(comment.createUserName))}"></li><li class="dec" th:utext="${comment.commentContent}"></li><li class="other cf"><span class="time fl" th:text="${#calendars.format(comment.createTime, 'yyyy-MM-dd HH:mm:ss')}"></span><span class="fr"><a href="javascript:void(0);" onclick="javascript:BookDetail.AddAgreeTotal(77,this);" class="zan" style="display: none;">赞<i class="num">(0)</i></a></span></li> </ul> </div>
|
th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
||||||
|
<div th:each="comment: ${bookCommentPageBean.list}" class="comment_list cf">
|
||||||
|
<div class="user_heads fl" vals="389"><img
|
||||||
|
th:src="${comment.createUserPhoto}?${comment.createUserPhoto}:'/images/man.png'"
|
||||||
|
class="user_head" alt=""><span class="user_level1"
|
||||||
|
style="display: none;">见习</span></div>
|
||||||
|
<ul class="pl_bar fr">
|
||||||
|
<li class="name"><span
|
||||||
|
th:text="${#strings.substring(comment.createUserName,0,4)}+'****'+${#strings.substring(comment.createUserName,#strings.length(comment.createUserName)-3,#strings.length(comment.createUserName))}"></span><span
|
||||||
|
style="padding-left: 10px" class="other" th:if="${comment.location}"
|
||||||
|
th:text="${comment.location} + '读者'"></span></span></li>
|
||||||
|
<li class="dec" th:utext="${comment.commentContent}"></li>
|
||||||
|
<li class="other cf"><span class="time fl"
|
||||||
|
th:text="${comment.createTimeFormat}"></span><span
|
||||||
|
class="fr"><a th:href="'javascript:toggleCommentUnLike(\''+${comment.id}+'\')'" onclick="javascript:;" class="zan"
|
||||||
|
style="padding-left: 10px">踩<i class="num" th:id="'unLikeCount'+${comment.id}">([[${comment.unLikesCount}]])</i></a></span><span
|
||||||
|
class="fr"><a th:href="'javascript:toggleCommentLike(\''+${comment.id}+'\')'" class="zan"
|
||||||
|
style="padding-left: 10px">赞<i class="num" th:id="'likeCount'+${comment.id}">([[${comment.likesCount}]])</i></a></span><span
|
||||||
|
class="fr"><a th:href="'/book/reply-'+${comment.id}+'.html'" class="zan"
|
||||||
|
style="padding-left: 10px">回复<i class="num">([[${comment.replyCount}]])</i></a></span>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!--无评论时此处隐藏-->
|
<!--无评论时此处隐藏-->
|
||||||
<div class="more_bar" id="moreCommentPanel" th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
<div class="more_bar" id="moreCommentPanel"
|
||||||
|
th:style="${bookCommentPageBean.total == 0}? 'display:none'">
|
||||||
<a th:href="'/book/comment-'+${book.id}+'.html'">查看全部评论></a>
|
<a th:href="'/book/comment-'+${book.id}+'.html'">查看全部评论></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -109,7 +138,7 @@
|
|||||||
<span class="fl font16">发表评论</span>
|
<span class="fl font16">发表评论</span>
|
||||||
<!--未登录状态下不可发表评论,显示以下链接-->
|
<!--未登录状态下不可发表评论,显示以下链接-->
|
||||||
<span class="fr black9" style="display:none; ">请先 <a class="orange"
|
<span class="fr black9" style="display:none; ">请先 <a class="orange"
|
||||||
href="/user/login.html">登录</a><em
|
href="/user/login.html">登录</a><em
|
||||||
class="ml10 mr10">|</em><a class="orange"
|
class="ml10 mr10">|</em><a class="orange"
|
||||||
href="/user/register.html">注册</a></span>
|
href="/user/register.html">注册</a></span>
|
||||||
</div>
|
</div>
|
||||||
@ -175,10 +204,12 @@
|
|||||||
<li th:each="book : ${recBooks}">
|
<li th:each="book : ${recBooks}">
|
||||||
<div class="book_intro">
|
<div class="book_intro">
|
||||||
<div class="cover">
|
<div class="cover">
|
||||||
<a th:href="'/book/'+${book.id}+'.html'"><img th:src="${book.picUrl}" th:alt="${book.bookName}"></a>
|
<a th:href="'/book/'+${book.id}+'.html'"><img th:src="${book.picUrl}"
|
||||||
|
th:alt="${book.bookName}"></a>
|
||||||
</div>
|
</div>
|
||||||
<div class="dec">
|
<div class="dec">
|
||||||
<a class="book_name" th:href="'/book/'+${book.id}+'.html'" th:text="${book.bookName}"></a>
|
<a class="book_name" th:href="'/book/'+${book.id}+'.html'"
|
||||||
|
th:text="${book.bookName}"></a>
|
||||||
<a class="txt" th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookDesc}">
|
<a class="txt" th:href="'/book/'+${book.id}+'.html'" th:utext="${book.bookDesc}">
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
@ -210,7 +241,7 @@
|
|||||||
var bookId = pathname.substring(pathname.lastIndexOf("/") + 1, pathname.lastIndexOf("."))
|
var bookId = pathname.substring(pathname.lastIndexOf("/") + 1, pathname.lastIndexOf("."))
|
||||||
//查询章节信息
|
//查询章节信息
|
||||||
var lastBookIndexId = $("#lastBookIndexId").val();
|
var lastBookIndexId = $("#lastBookIndexId").val();
|
||||||
if(lastBookIndexId){
|
if (lastBookIndexId) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/book/queryBookIndexAbout",
|
url: "/book/queryBookIndexAbout",
|
||||||
@ -232,7 +263,7 @@
|
|||||||
layer.alert('网络异常');
|
layer.alert('网络异常');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}else{
|
} else {
|
||||||
$("#optBtn").remove();
|
$("#optBtn").remove();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -264,9 +295,6 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var currentBId = 37, spmymoney = 0;
|
var currentBId = 37, spmymoney = 0;
|
||||||
var relationStep = 0;
|
var relationStep = 0;
|
||||||
var authorUId = 8;
|
var authorUId = 8;
|
||||||
@ -283,7 +311,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$("#AuthorOtherNovel li").unbind("mouseover");
|
$("#AuthorOtherNovel li").unbind("mouseover");
|
||||||
|
|
||||||
$('#txtComment').on('input propertychange', function () {
|
$('#txtComment').on('input propertychange', function () {
|
||||||
@ -301,7 +328,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function loadCommentList(){
|
function loadCommentList() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "get",
|
type: "get",
|
||||||
url: "/book/listCommentByPage",
|
url: "/book/listCommentByPage",
|
||||||
@ -311,20 +338,25 @@
|
|||||||
if (data.code == 200) {
|
if (data.code == 200) {
|
||||||
var commentList = data.data.list;
|
var commentList = data.data.list;
|
||||||
if (commentList.length > 0) {
|
if (commentList.length > 0) {
|
||||||
$("#bookCommentTotal").html("("+data.data.total+"条)");
|
$("#bookCommentTotal").html("(" + data.data.total + "条)");
|
||||||
var commentListHtml = "";
|
var commentListHtml = "";
|
||||||
for (var i = 0; i < commentList.length; i++) {
|
for (var i = 0; i < commentList.length; i++) {
|
||||||
var comment = commentList[i];
|
var comment = commentList[i];
|
||||||
commentListHtml += ("<div class=\"comment_list cf\">" +
|
commentListHtml += ("<div class=\"comment_list cf\">" +
|
||||||
"<div class=\"user_heads fl\" vals=\"389\">" +
|
"<div class=\"user_heads fl\" vals=\"389\">" +
|
||||||
"<img src=\""+(comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png')+"\" class=\"user_head\" alt=\"\">" +
|
"<img src=\"" + (comment.createUserPhoto ? comment.createUserPhoto : '/images/man.png') + "\" class=\"user_head\" alt=\"\">" +
|
||||||
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
"<span class=\"user_level1\" style=\"display: none;\">见习</span></div>" +
|
||||||
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">"+(comment.createUserName)+"</li><li class=\"dec\">" +
|
"<ul class=\"pl_bar fr\">\t\t\t<li class=\"name\">" + (comment.createUserName) + "<span style='padding-left: 10px' class=\"other\">" + (comment.location ? comment.location + "读者" : '') + "</span></li><li class=\"dec\">" +
|
||||||
comment.commentContent+
|
comment.commentContent +
|
||||||
"</li><li class=\"other cf\">" +
|
"</li><li class=\"other cf\">" +
|
||||||
"<span class=\"time fl\">"+comment.createTime+"</span>" +
|
"<span class=\"time fl\">" + comment.createTime + "</span>" +
|
||||||
"<span class=\"fr\"><a href=\"javascript:void(0);\" onclick=\"javascript:BookDetail.AddAgreeTotal(77,this);\" class=\"zan\" style=\"display: none;\">赞<i class=\"num\">(0)</i></a>" +
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentUnLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">踩<i class=\"num\" id='unLikeCount"+comment.id+"'>("+comment.unLikesCount+")</i></a></span>" +
|
||||||
"</span></li>\t\t</ul>\t</div>");
|
"<span class=\"fr\"><a href=\"javascript:toggleCommentLike('"+comment.id+"')\" class=\"zan\" style=\"padding-left: 10px\">赞<i class=\"num\" id='likeCount"+comment.id+"'>("+comment.likesCount+")</i></a></span>" +
|
||||||
|
"<span class=\"fr\"><a href=\"/book/reply-"+comment.id+".html\" class=\"zan\" style=\"padding-left: 10px\">回复<i class=\"num\">("+comment.replyCount+
|
||||||
|
")</i></a></span>" +
|
||||||
|
"</li>\t\t</ul>\t</div>"
|
||||||
|
)
|
||||||
|
;
|
||||||
}
|
}
|
||||||
$("#commentPanel").html(commentListHtml);
|
$("#commentPanel").html(commentListHtml);
|
||||||
$("#noCommentPanel").hide();
|
$("#noCommentPanel").hide();
|
||||||
@ -348,6 +380,55 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
function toggleCommentLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#likeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function toggleCommentUnLike(commentId) {
|
||||||
|
$.ajax({
|
||||||
|
type: "post",
|
||||||
|
url: "/book/toggleCommentUnLike",
|
||||||
|
data: {'commentId': commentId},
|
||||||
|
dataType: "json",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.code == 200) {
|
||||||
|
$("#unLikeCount"+commentId).text("("+data.data+")")
|
||||||
|
} else if (data.code == 1001) {
|
||||||
|
//未登录
|
||||||
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
layer.alert(data.msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
error: function () {
|
||||||
|
layer.alert('网络异常');
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="userBox cf">
|
<div class="userBox cf">
|
||||||
<div class="user_l">
|
<div class="user_l">
|
||||||
<form method="post" action="./login.html" id="form1">
|
<form method="post" action="./login.html" id="form1">
|
||||||
<h3 th:text="'登陆'+${application.website.name}"></h3>
|
<h3 th:text="'登录'+${application.website.name}"></h3>
|
||||||
<ul class="log_list">
|
<ul class="log_list">
|
||||||
<li><span id="LabErr"></span></li>
|
<li><span id="LabErr"></span></li>
|
||||||
<li><input name="txtUName" type="text" id="txtUName" placeholder="手机号码" class="s_input icon_name" /></li>
|
<li><input name="txtUName" type="text" id="txtUName" placeholder="手机号码" class="s_input icon_name" /></li>
|
||||||
|
@ -964,4 +964,14 @@ i.vip_b {
|
|||||||
|
|
||||||
.userBox {
|
.userBox {
|
||||||
margin: 0 auto
|
margin: 0 auto
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.layui-elem-quote {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
padding: 15px;
|
||||||
|
line-height: 1.8;
|
||||||
|
border-left: 5px solid #16b777;
|
||||||
|
border-radius: 0 2px 2px 0;
|
||||||
|
background-color: #fafafa;
|
||||||
}
|
}
|
@ -91,7 +91,7 @@
|
|||||||
},
|
},
|
||||||
SaveComment: function (cmtBId, cmtCId, cmtDetail) {
|
SaveComment: function (cmtBId, cmtCId, cmtDetail) {
|
||||||
if (!isLogin) {
|
if (!isLogin) {
|
||||||
layer.alert('请先登陆');
|
layer.alert('请先登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
||||||
|
@ -176,7 +176,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -206,7 +206,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -212,7 +212,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -231,7 +231,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -261,7 +261,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -213,7 +213,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -273,7 +273,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -311,7 +311,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -380,7 +380,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -274,7 +274,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -244,7 +244,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -99,7 +99,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -144,7 +144,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -74,7 +74,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<div class="userBox cf">
|
<div class="userBox cf">
|
||||||
<div class="user_l">
|
<div class="user_l">
|
||||||
<form method="post" action="./login.html" id="form1">
|
<form method="post" action="./login.html" id="form1">
|
||||||
<h3 th:text="'登陆'+${application.website.name}"></h3>
|
<h3 th:text="'登录'+${application.website.name}"></h3>
|
||||||
<ul class="log_list">
|
<ul class="log_list">
|
||||||
<li><span id="LabErr"></span></li>
|
<li><span id="LabErr"></span></li>
|
||||||
<li><input name="txtUName" type="text" id="txtUName" placeholder="手机号码" class="s_input icon_name" /></li>
|
<li><input name="txtUName" type="text" id="txtUName" placeholder="手机号码" class="s_input icon_name" /></li>
|
||||||
|
@ -131,7 +131,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -96,7 +96,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$("#LabErr").html(data.msg);
|
$("#LabErr").html(data.msg);
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$("#LabErr").html(data.msg);
|
$("#LabErr").html(data.msg);
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -81,7 +81,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -79,7 +79,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -118,7 +118,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
@ -92,7 +92,7 @@
|
|||||||
},
|
},
|
||||||
SaveComment: function (cmtBId, cmtCId, cmtDetail) {
|
SaveComment: function (cmtBId, cmtCId, cmtDetail) {
|
||||||
if(!isLogin){
|
if(!isLogin){
|
||||||
layer.alert('请先登陆');
|
layer.alert('请先登录');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
var cmtDetailTemp = cmtDetail.replace(/(^\s*)/g, "");
|
||||||
@ -121,7 +121,7 @@
|
|||||||
|
|
||||||
} else if (data.code == 1001) {
|
} else if (data.code == 1001) {
|
||||||
//未登录
|
//未登录
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
layer.alert(data.msg);
|
layer.alert(data.msg);
|
||||||
|
@ -106,7 +106,7 @@ Array.prototype.remove = function (val) {
|
|||||||
var token = $.cookie('Authorization');
|
var token = $.cookie('Authorization');
|
||||||
if (!token) {
|
if (!token) {
|
||||||
if (needLoginPath.indexOf(window.location.pathname) != -1) {
|
if (needLoginPath.indexOf(window.location.pathname) != -1) {
|
||||||
location.href = '/user/login.html?originUrl=' + decodeURIComponent(location.href);
|
location.href = '/user/login.html?originUrl=' + encodeURIComponent(location.href);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(".user_link").html("<a href=\"/user/login.html\">登录</a>|<a href=\"/user/register.html\">注册</a>");
|
$(".user_link").html("<a href=\"/user/login.html\">登录</a>|<a href=\"/user/register.html\">注册</a>");
|
||||||
|
Reference in New Issue
Block a user