mirror of
https://github.com/201206030/novel-plus.git
synced 2025-08-20 23:08:46 +00:00
Compare commits
No commits in common. "develop_xxy" and "v5.2.3" have entirely different histories.
develop_xx
...
v5.2.3
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<artifactId>novel-admin</artifactId>
|
<artifactId>novel-admin</artifactId>
|
||||||
<version>5.2.5</version>
|
<version>5.2.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>novel-admin</name>
|
<name>novel-admin</name>
|
||||||
|
@ -9,7 +9,7 @@ import com.java2nb.novel.service.FriendLinkService;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -31,7 +31,7 @@ public class FriendLinkController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private FriendLinkService friendLinkService;
|
private FriendLinkService friendLinkService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private StringRedisTemplate redisTemplate;
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@RequiresPermissions("novel:friendLink:friendLink")
|
@RequiresPermissions("novel:friendLink:friendLink")
|
||||||
|
@ -9,7 +9,7 @@ import com.java2nb.novel.service.NewsService;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -32,7 +32,7 @@ public class NewsController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private NewsService newsService;
|
private NewsService newsService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private StringRedisTemplate redisTemplate;
|
private RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@RequiresPermissions("novel:news:news")
|
@RequiresPermissions("novel:news:news")
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.2.5</version>
|
<version>5.2.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ public interface CacheKey {
|
|||||||
/**
|
/**
|
||||||
* 首页小说设置
|
* 首页小说设置
|
||||||
* */
|
* */
|
||||||
String INDEX_BOOK_SETTINGS_KEY = "indexBookSettingsKey:v2";
|
String INDEX_BOOK_SETTINGS_KEY = "indexBookSettingsKey";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 首页新闻
|
* 首页新闻
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package com.java2nb.novel.core.cache;
|
package com.java2nb.novel.core.cache;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author 11797
|
* @author 11797
|
||||||
*/
|
*/
|
||||||
@ -27,9 +23,7 @@ public interface CacheService {
|
|||||||
/**
|
/**
|
||||||
* 根据key获取缓存的Object类型数据
|
* 根据key获取缓存的Object类型数据
|
||||||
*/
|
*/
|
||||||
<T> T getObject(String key, Class<T> clazz);
|
Object getObject(String key);
|
||||||
|
|
||||||
<T> List<T> getList(String key, Class<T> clazz);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置Object类型的缓存
|
* 设置Object类型的缓存
|
||||||
@ -49,12 +43,12 @@ public interface CacheService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断是否存在一个key
|
* 判断是否存在一个key
|
||||||
*/
|
* */
|
||||||
boolean contains(String key);
|
boolean contains(String key);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置key过期时间
|
* 设置key过期时间
|
||||||
*/
|
* */
|
||||||
void expire(String key, long timeout);
|
void expire(String key, long timeout);
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,35 +1,23 @@
|
|||||||
package com.java2nb.novel.core.cache.impl;
|
package com.java2nb.novel.core.cache.impl;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.java2nb.novel.core.cache.CacheService;
|
import com.java2nb.novel.core.cache.CacheService;
|
||||||
import jakarta.annotation.PostConstruct;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xxy
|
* @author xxy
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class RedisServiceImpl implements CacheService {
|
public class RedisServiceImpl implements CacheService {
|
||||||
|
|
||||||
private final StringRedisTemplate stringRedisTemplate;
|
private final StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
private ObjectMapper objectMapper;
|
private final RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void init() {
|
|
||||||
objectMapper = new ObjectMapper();
|
|
||||||
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -49,66 +37,34 @@ public class RedisServiceImpl implements CacheService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public <T> T getObject(String key, Class<T> clazz) {
|
public Object getObject(String key) {
|
||||||
String result = get(key);
|
return redisTemplate.opsForValue().get(key);
|
||||||
if (result != null) {
|
|
||||||
try {
|
|
||||||
return objectMapper.readValue(result, clazz);
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public <T> List<T> getList(String key, Class<T> clazz) {
|
|
||||||
String result = get(key);
|
|
||||||
if (result != null) {
|
|
||||||
try {
|
|
||||||
return objectMapper.readValue(result,
|
|
||||||
objectMapper.getTypeFactory().constructCollectionType(List.class, clazz));
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setObject(String key, Object value) {
|
public void setObject(String key, Object value) {
|
||||||
if (value != null) {
|
redisTemplate.opsForValue().set(key, value);
|
||||||
try {
|
|
||||||
set(key, objectMapper.writeValueAsString(value));
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setObject(String key, Object value, long timeout) {
|
public void setObject(String key, Object value, long timeout) {
|
||||||
if (value != null) {
|
redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS);
|
||||||
try {
|
|
||||||
set(key, objectMapper.writeValueAsString(value), timeout);
|
|
||||||
} catch (JsonProcessingException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void del(String key) {
|
public void del(String key) {
|
||||||
|
redisTemplate.delete(key);
|
||||||
stringRedisTemplate.delete(key);
|
stringRedisTemplate.delete(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean contains(String key) {
|
public boolean contains(String key) {
|
||||||
return stringRedisTemplate.hasKey(key);
|
return redisTemplate.hasKey(key) || stringRedisTemplate.hasKey(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void expire(String key, long timeout) {
|
public void expire(String key, long timeout) {
|
||||||
|
redisTemplate.expire(key, timeout, TimeUnit.SECONDS);
|
||||||
stringRedisTemplate.expire(key, timeout, TimeUnit.SECONDS);
|
stringRedisTemplate.expire(key, timeout, TimeUnit.SECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ http:
|
|||||||
# 是否开启 HTTP 代理,true-开启,false-不开启
|
# 是否开启 HTTP 代理,true-开启,false-不开启
|
||||||
enabled: false
|
enabled: false
|
||||||
# 代理 IP
|
# 代理 IP
|
||||||
ip: proxy.bestproxy.com
|
ip: us.swiftproxy.net
|
||||||
# 代理端口号
|
# 代理端口号
|
||||||
port: 2312
|
port: 7878
|
||||||
# 代理用户名
|
# 代理用户名
|
||||||
username: bestproxy_u
|
username: swiftproxy_u
|
||||||
# 代理密码
|
# 代理密码
|
||||||
password: bestproxy_p
|
password: swiftproxy_p
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.2.5</version>
|
<version>5.2.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
@ -38,10 +38,10 @@ http:
|
|||||||
# 是否开启 HTTP 代理,true-开启,false-不开启
|
# 是否开启 HTTP 代理,true-开启,false-不开启
|
||||||
enabled: false
|
enabled: false
|
||||||
# 代理 IP
|
# 代理 IP
|
||||||
ip: proxy.bestproxy.com
|
ip: us.swiftproxy.net
|
||||||
# 代理端口号
|
# 代理端口号
|
||||||
port: 2312
|
port: 7878
|
||||||
# 代理用户名
|
# 代理用户名
|
||||||
username: bestproxy_u
|
username: swiftproxy_u
|
||||||
# 代理密码
|
# 代理密码
|
||||||
password: bestproxy_p
|
password: swiftproxy_p
|
@ -72,15 +72,17 @@ public class CrawlController {
|
|||||||
if(url.startsWith("https://")||url.startsWith("http://")){
|
if(url.startsWith("https://")||url.startsWith("http://")){
|
||||||
String refreshCache="1";
|
String refreshCache="1";
|
||||||
if(!refreshCache.equals(isRefresh)) {
|
if(!refreshCache.equals(isRefresh)) {
|
||||||
html = cacheService.get(CacheKey.BOOK_TEST_PARSE + url);
|
Object cache = cacheService.getObject(CacheKey.BOOK_TEST_PARSE + url);
|
||||||
if (html == null) {
|
if (cache == null) {
|
||||||
isRefresh="1";
|
isRefresh="1";
|
||||||
|
}else {
|
||||||
|
html = (String) cache;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(refreshCache.equals(isRefresh)){
|
if(refreshCache.equals(isRefresh)){
|
||||||
html = HttpUtil.getByHttpClientWithChrome(url);
|
html = HttpUtil.getByHttpClientWithChrome(url);
|
||||||
if (html != null) {
|
if (html != null) {
|
||||||
cacheService.set(CacheKey.BOOK_TEST_PARSE + url, html, 60 * 10);
|
cacheService.setObject(CacheKey.BOOK_TEST_PARSE + url, html, 60 * 10);
|
||||||
}else{
|
}else{
|
||||||
resultMap.put("msg","html is null");
|
resultMap.put("msg","html is null");
|
||||||
return RestResult.ok(resultMap);
|
return RestResult.ok(resultMap);
|
||||||
|
@ -12,6 +12,7 @@ import io.github.xxyopen.util.IdWorker;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
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.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<artifactId>novel</artifactId>
|
<artifactId>novel</artifactId>
|
||||||
<groupId>com.java2nb</groupId>
|
<groupId>com.java2nb</groupId>
|
||||||
<version>5.2.5</version>
|
<version>5.2.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
@ -96,16 +96,6 @@
|
|||||||
<include name="application-website.yml"/>
|
<include name="application-website.yml"/>
|
||||||
</fileset>
|
</fileset>
|
||||||
</copy>
|
</copy>
|
||||||
<copy todir="${basedir}/../templates/green/html" overwrite="true">
|
|
||||||
<fileset dir="${basedir}/src/main/resources/templates">
|
|
||||||
<include name="**/*.*"/>
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
<copy todir="${basedir}/../templates/green/static" overwrite="true">
|
|
||||||
<fileset dir="${basedir}/src/main/resources/static">
|
|
||||||
<include name="**/*.*"/>
|
|
||||||
</fileset>
|
|
||||||
</copy>
|
|
||||||
<copy todir="${project.build.directory}/build/templates" overwrite="true">
|
<copy todir="${project.build.directory}/build/templates" overwrite="true">
|
||||||
<fileset dir="${basedir}/../templates">
|
<fileset dir="${basedir}/../templates">
|
||||||
<include name="**/*.*"/>
|
<include name="**/*.*"/>
|
||||||
|
@ -41,13 +41,13 @@ http:
|
|||||||
# 是否开启 HTTP 代理,true-开启,false-不开启
|
# 是否开启 HTTP 代理,true-开启,false-不开启
|
||||||
enabled: false
|
enabled: false
|
||||||
# 代理 IP
|
# 代理 IP
|
||||||
ip: proxy.bestproxy.com
|
ip: us.swiftproxy.net
|
||||||
# 代理端口号
|
# 代理端口号
|
||||||
port: 2312
|
port: 7878
|
||||||
# 代理用户名
|
# 代理用户名
|
||||||
username: bestproxy_u
|
username: swiftproxy_u
|
||||||
# 代理密码
|
# 代理密码
|
||||||
password: bestproxy_p
|
password: swiftproxy_p
|
||||||
|
|
||||||
|
|
||||||
--- #--------------------- Spring AI 配置----------------------
|
--- #--------------------- Spring AI 配置----------------------
|
||||||
|
@ -110,6 +110,20 @@ public class AuthorController extends BaseController {
|
|||||||
return RestResult.ok();
|
return RestResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新章节名
|
||||||
|
*/
|
||||||
|
@PostMapping("updateIndexName")
|
||||||
|
public RestResult<Void> updateIndexName(Long indexId, String indexName, HttpServletRequest request) {
|
||||||
|
|
||||||
|
Author author = checkAuthor(request);
|
||||||
|
|
||||||
|
//更新章节名
|
||||||
|
bookService.updateIndexName(indexId, indexName, author.getId());
|
||||||
|
|
||||||
|
return RestResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发布章节内容
|
* 发布章节内容
|
||||||
|
@ -43,7 +43,7 @@ public class BookController extends BaseController {
|
|||||||
* 查询首页小说设置列表数据
|
* 查询首页小说设置列表数据
|
||||||
*/
|
*/
|
||||||
@GetMapping("listBookSetting")
|
@GetMapping("listBookSetting")
|
||||||
public RestResult<Map<String, List<BookSettingVO>>> listBookSetting() {
|
public RestResult<Map<Byte, List<BookSettingVO>>> listBookSetting() {
|
||||||
return RestResult.ok(bookService.listBookSettingVO());
|
return RestResult.ok(bookService.listBookSettingVO());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ public class PageController extends BaseController {
|
|||||||
@RequestMapping(path = {"/", "/index", "/index.html"})
|
@RequestMapping(path = {"/", "/index", "/index.html"})
|
||||||
public String index(Model model) {
|
public String index(Model model) {
|
||||||
//加载小说首页小说基本信息线程
|
//加载小说首页小说基本信息线程
|
||||||
CompletableFuture<Map<String, List<BookSettingVO>>> bookCompletableFuture = CompletableFuture.supplyAsync(
|
CompletableFuture<Map<Byte, List<BookSettingVO>>> bookCompletableFuture = CompletableFuture.supplyAsync(
|
||||||
bookService::listBookSettingVO, threadPoolExecutor);
|
bookService::listBookSettingVO, threadPoolExecutor);
|
||||||
//加载首页新闻线程
|
//加载首页新闻线程
|
||||||
CompletableFuture<List<News>> newsCompletableFuture = CompletableFuture.supplyAsync(newsService::listIndexNews,
|
CompletableFuture<List<News>> newsCompletableFuture = CompletableFuture.supplyAsync(newsService::listIndexNews,
|
||||||
|
@ -16,10 +16,9 @@ public interface BookService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询首页小说设置列表数据
|
* 查询首页小说设置列表数据
|
||||||
*
|
|
||||||
* @return
|
* @return
|
||||||
*/
|
* */
|
||||||
Map<String, List<BookSettingVO>> listBookSettingVO();
|
Map<Byte, List<BookSettingVO>> listBookSettingVO();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询首页点击榜单数据
|
* 查询首页点击榜单数据
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.java2nb.novel.service.impl;
|
package com.java2nb.novel.service.impl;
|
||||||
|
|
||||||
|
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.CacheKey;
|
||||||
import com.java2nb.novel.core.cache.CacheService;
|
import com.java2nb.novel.core.cache.CacheService;
|
||||||
@ -24,6 +25,7 @@ import io.github.xxyopen.web.util.BeanUtil;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.http.client.utils.DateUtils;
|
import org.apache.http.client.utils.DateUtils;
|
||||||
import org.mybatis.dynamic.sql.SortSpecification;
|
import org.mybatis.dynamic.sql.SortSpecification;
|
||||||
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
import org.mybatis.dynamic.sql.render.RenderingStrategies;
|
||||||
@ -46,6 +48,7 @@ import java.util.concurrent.ThreadPoolExecutor;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.java2nb.novel.mapper.BookCategoryDynamicSqlSupport.bookCategory;
|
import static com.java2nb.novel.mapper.BookCategoryDynamicSqlSupport.bookCategory;
|
||||||
|
import static com.java2nb.novel.mapper.BookCategoryDynamicSqlSupport.sort;
|
||||||
import static com.java2nb.novel.mapper.BookCommentDynamicSqlSupport.bookComment;
|
import static com.java2nb.novel.mapper.BookCommentDynamicSqlSupport.bookComment;
|
||||||
import static com.java2nb.novel.mapper.BookContentDynamicSqlSupport.bookContent;
|
import static com.java2nb.novel.mapper.BookContentDynamicSqlSupport.bookContent;
|
||||||
import static com.java2nb.novel.mapper.BookContentDynamicSqlSupport.content;
|
import static com.java2nb.novel.mapper.BookContentDynamicSqlSupport.content;
|
||||||
@ -105,19 +108,19 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<BookSettingVO>> listBookSettingVO() {
|
public Map<Byte, List<BookSettingVO>> listBookSettingVO() {
|
||||||
List<BookSettingVO> list = cacheService.getList(CacheKey.INDEX_BOOK_SETTINGS_KEY, BookSettingVO.class);
|
String result = cacheService.get(CacheKey.INDEX_BOOK_SETTINGS_KEY);
|
||||||
if (list == null || list.isEmpty()) {
|
if (result == null || result.length() < Constants.OBJECT_JSON_CACHE_EXIST_LENGTH) {
|
||||||
list = bookSettingMapper.listVO();
|
List<BookSettingVO> list = bookSettingMapper.listVO();
|
||||||
if (list.isEmpty()) {
|
if (list.size() == 0) {
|
||||||
//如果首页小说没有被设置,则初始化首页小说设置
|
//如果首页小说没有被设置,则初始化首页小说设置
|
||||||
list = initIndexBookSetting();
|
list = initIndexBookSetting();
|
||||||
}
|
}
|
||||||
cacheService.setObject(CacheKey.INDEX_BOOK_SETTINGS_KEY, list, 3600 * 24);
|
result = new ObjectMapper().writeValueAsString(
|
||||||
|
list.stream().collect(Collectors.groupingBy(BookSettingVO::getType)));
|
||||||
|
cacheService.set(CacheKey.INDEX_BOOK_SETTINGS_KEY, result, 3600 * 24);
|
||||||
}
|
}
|
||||||
return list.stream().collect(
|
return new ObjectMapper().readValue(result, Map.class);
|
||||||
Collectors.groupingBy(book -> book.getType().toString())
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -167,10 +170,11 @@ public class BookServiceImpl implements BookService {
|
|||||||
return new ArrayList<>(0);
|
return new ArrayList<>(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Book> listClickRank() {
|
public List<Book> listClickRank() {
|
||||||
List<Book> result = cacheService.getList(CacheKey.INDEX_CLICK_BANK_BOOK_KEY, Book.class);
|
List<Book> result = (List<Book>) cacheService.getObject(CacheKey.INDEX_CLICK_BANK_BOOK_KEY);
|
||||||
if (result == null || result.isEmpty()) {
|
if (result == null || result.size() == 0) {
|
||||||
result = listRank((byte) 0, 10);
|
result = listRank((byte) 0, 10);
|
||||||
cacheService.setObject(CacheKey.INDEX_CLICK_BANK_BOOK_KEY, result, 5000);
|
cacheService.setObject(CacheKey.INDEX_CLICK_BANK_BOOK_KEY, result, 5000);
|
||||||
}
|
}
|
||||||
@ -179,8 +183,8 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<Book> listNewRank() {
|
public List<Book> listNewRank() {
|
||||||
List<Book> result = cacheService.getList(CacheKey.INDEX_NEW_BOOK_KEY, Book.class);
|
List<Book> result = (List<Book>) cacheService.getObject(CacheKey.INDEX_NEW_BOOK_KEY);
|
||||||
if (result == null || result.isEmpty()) {
|
if (result == null || result.size() == 0) {
|
||||||
result = listRank((byte) 1, 10);
|
result = listRank((byte) 1, 10);
|
||||||
cacheService.setObject(CacheKey.INDEX_NEW_BOOK_KEY, result, 3600);
|
cacheService.setObject(CacheKey.INDEX_NEW_BOOK_KEY, result, 3600);
|
||||||
}
|
}
|
||||||
@ -189,8 +193,8 @@ public class BookServiceImpl implements BookService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<BookVO> listUpdateRank() {
|
public List<BookVO> listUpdateRank() {
|
||||||
List<BookVO> result = cacheService.getList(CacheKey.INDEX_UPDATE_BOOK_KEY, BookVO.class);
|
List<BookVO> result = (List<BookVO>) cacheService.getObject(CacheKey.INDEX_UPDATE_BOOK_KEY);
|
||||||
if (result == null || result.isEmpty()) {
|
if (result == null || result.size() == 0) {
|
||||||
List<Book> bookPOList = listRank((byte) 2, 23);
|
List<Book> bookPOList = listRank((byte) 2, 23);
|
||||||
result = BeanUtil.copyList(bookPOList, BookVO.class);
|
result = BeanUtil.copyList(bookPOList, BookVO.class);
|
||||||
cacheService.setObject(CacheKey.INDEX_UPDATE_BOOK_KEY, result, 60 * 10);
|
cacheService.setObject(CacheKey.INDEX_UPDATE_BOOK_KEY, result, 60 * 10);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.java2nb.novel.service.impl;
|
package com.java2nb.novel.service.impl;
|
||||||
|
|
||||||
|
import io.github.xxyopen.web.util.BeanUtil;
|
||||||
import com.java2nb.novel.service.FriendLinkService;
|
import com.java2nb.novel.service.FriendLinkService;
|
||||||
import com.java2nb.novel.core.cache.CacheKey;
|
import com.java2nb.novel.core.cache.CacheKey;
|
||||||
import com.java2nb.novel.core.cache.CacheService;
|
import com.java2nb.novel.core.cache.CacheService;
|
||||||
@ -30,16 +31,16 @@ public class FriendLinkServiceImpl implements FriendLinkService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<FriendLink> listIndexLink() {
|
public List<FriendLink> listIndexLink() {
|
||||||
List<FriendLink> result = cacheService.getList(CacheKey.INDEX_LINK_KEY, FriendLink.class);
|
List<FriendLink> result = (List<FriendLink>) cacheService.getObject(CacheKey.INDEX_LINK_KEY);
|
||||||
if (result == null || result.isEmpty()) {
|
if(result == null || result.size() == 0) {
|
||||||
SelectStatementProvider selectStatement = select(linkName, linkUrl)
|
SelectStatementProvider selectStatement = select(linkName,linkUrl)
|
||||||
.from(friendLink)
|
.from(friendLink)
|
||||||
.where(isOpen, isEqualTo((byte) 1))
|
.where(isOpen,isEqualTo((byte)1))
|
||||||
.orderBy(sort)
|
.orderBy(sort)
|
||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
result = friendLinkMapper.selectMany(selectStatement);
|
result = friendLinkMapper.selectMany(selectStatement);
|
||||||
cacheService.setObject(CacheKey.INDEX_LINK_KEY, result, 60 * 60 * 24);
|
cacheService.setObject(CacheKey.INDEX_LINK_KEY,result,60 * 60 * 24);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import com.java2nb.novel.service.LikeService;
|
|||||||
import jakarta.annotation.PostConstruct;
|
import jakarta.annotation.PostConstruct;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
import org.springframework.data.redis.core.script.DefaultRedisScript;
|
||||||
import org.springframework.scripting.support.StaticScriptSource;
|
import org.springframework.scripting.support.StaticScriptSource;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -20,7 +20,7 @@ import java.util.Collections;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class LikeServiceImpl implements LikeService {
|
public class LikeServiceImpl implements LikeService {
|
||||||
|
|
||||||
private final StringRedisTemplate redisTemplate;
|
private final RedisTemplate<Object, Object> redisTemplate;
|
||||||
|
|
||||||
private DefaultRedisScript<Long> toggleLikeScript;
|
private DefaultRedisScript<Long> toggleLikeScript;
|
||||||
|
|
||||||
@ -89,6 +89,6 @@ public class LikeServiceImpl implements LikeService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private Long executeToggle(String key, Long userId) {
|
private Long executeToggle(String key, Long userId) {
|
||||||
return redisTemplate.execute(toggleLikeScript, Collections.singletonList(key), String.valueOf(userId));
|
return redisTemplate.execute(toggleLikeScript, Collections.singletonList(key), userId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,16 +36,16 @@ public class NewsServiceImpl implements NewsService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<News> listIndexNews() {
|
public List<News> listIndexNews() {
|
||||||
List<News> result = cacheService.getList(CacheKey.INDEX_NEWS_KEY, News.class);
|
List<News> result = (List<News>) cacheService.getObject(CacheKey.INDEX_NEWS_KEY);
|
||||||
if (result == null || result.isEmpty()) {
|
if(result == null || result.size() == 0) {
|
||||||
SelectStatementProvider selectStatement = select(id, catName, catId, title, createTime)
|
SelectStatementProvider selectStatement = select(id, catName, catId, title,createTime)
|
||||||
.from(news)
|
.from(news)
|
||||||
.orderBy(createTime.descending())
|
.orderBy(createTime.descending())
|
||||||
.limit(2)
|
.limit(2)
|
||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
result = newsMapper.selectMany(selectStatement);
|
result = newsMapper.selectMany(selectStatement);
|
||||||
cacheService.setObject(CacheKey.INDEX_NEWS_KEY, result, 60 * 60 * 12);
|
cacheService.setObject(CacheKey.INDEX_NEWS_KEY,result,60 * 60 * 12);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -54,7 +54,7 @@ public class NewsServiceImpl implements NewsService {
|
|||||||
public News queryNewsInfo(Long newsId) {
|
public News queryNewsInfo(Long newsId) {
|
||||||
SelectStatementProvider selectStatement = select(news.allColumns())
|
SelectStatementProvider selectStatement = select(news.allColumns())
|
||||||
.from(news)
|
.from(news)
|
||||||
.where(id, isEqualTo(newsId))
|
.where(id,isEqualTo(newsId))
|
||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
return newsMapper.selectMany(selectStatement).get(0);
|
return newsMapper.selectMany(selectStatement).get(0);
|
||||||
@ -63,15 +63,15 @@ public class NewsServiceImpl implements NewsService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageBean<News> listByPage(int page, int pageSize) {
|
public PageBean<News> listByPage(int page, int pageSize) {
|
||||||
PageHelper.startPage(page, pageSize);
|
PageHelper.startPage(page,pageSize);
|
||||||
SelectStatementProvider selectStatement = select(id, catName, catId, title, createTime)
|
SelectStatementProvider selectStatement = select(id, catName, catId, title,createTime)
|
||||||
.from(news)
|
.from(news)
|
||||||
.orderBy(createTime.descending())
|
.orderBy(createTime.descending())
|
||||||
.build()
|
.build()
|
||||||
.render(RenderingStrategies.MYBATIS3);
|
.render(RenderingStrategies.MYBATIS3);
|
||||||
List<News> news = newsMapper.selectMany(selectStatement);
|
List<News> news = newsMapper.selectMany(selectStatement);
|
||||||
PageBean<News> pageBean = PageBuilder.build(news);
|
PageBean<News> pageBean = PageBuilder.build(news);
|
||||||
pageBean.setList(BeanUtil.copyList(news, NewsVO.class));
|
pageBean.setList(BeanUtil.copyList(news,NewsVO.class));
|
||||||
return pageBean;
|
return pageBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
@ -14,6 +16,8 @@
|
|||||||
|
|
||||||
<div th:include="mobile/common/css :: css"></div>
|
<div th:include="mobile/common/css :: css"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
|
||||||
@ -58,15 +62,6 @@
|
|||||||
height: 180px;
|
height: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.book_desc {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -192,19 +187,19 @@
|
|||||||
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:5px 0px;background: #f2f2f2\">\n" +
|
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||||
" <a href=\"/book/" + book.id + ".html\">\n" +
|
" <a href=\"/book/" + book.id + ".html\">\n" +
|
||||||
" <div class=\"layui-col-xs5 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
|
" <div class=\"layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
|
||||||
" <img style='width: 130px;height: 190px' align=\"center\"\n" +
|
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
|
||||||
" src=\"" + book.picUrl + "\"/>\n" +
|
" src=\"" + book.picUrl + "\"/>\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
" <div style=\"padding: 0px 10px 0px 0px\" class=\"layui-col-xs7 layui-col-sm9 layui-col-md10 layui-col-lg10\">\n" +
|
" <div style=\"padding: 10px\" class=\"layui-col-xs6 layui-col-sm8 layui-col-md8 layui-col-lg8\">\n" +
|
||||||
" <a href=\"/book/" + book.id + ".html\">\n" +
|
" <a href=\"/book/" + book.id + ".html\">\n" +
|
||||||
" <div class=\"line-limit-length\" style=\";color: #000;font-size: 15px\">" + book.bookName + "</div>\n" +
|
" <div class=\"line-limit-length\" style=\";color: #000;font-size: 15px\">" + book.bookName + "</div>\n" +
|
||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
" <div style=\"height: 5px;color: #4c6978;\"><i style=\"color: red\"></i></div>\n" +
|
" <div style=\";color: #4c6978;float: right;\"><i style=\"color: red\"></i></div>\n" +
|
||||||
" <a href=\"/book/book_ranking.html?keyword=" + encodeURI(book.authorName) + "\">\n" +
|
" <a href=\"/book/book_ranking.html?keyword=" + encodeURI(book.authorName) + "\">\n" +
|
||||||
" <div style=\";color: #a6a6a6;\" class=\"line-limit-length\">作者:" + book.authorName + "</div>\n" +
|
" <div style=\";color: #a6a6a6;\" class=\"line-limit-length\">作者:" + book.authorName + "</div>\n" +
|
||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
@ -212,7 +207,7 @@
|
|||||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "</div>\n" +
|
" <div style=\"margin-top: 5px;color: #a6a6a6;\">状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "</div>\n" +
|
||||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">更新:<i style='color: red'>" + book.lastIndexUpdateTime.substr(0, 11) + "</i>\n" +
|
" <div style=\"margin-top: 5px;color: #a6a6a6;\">更新:<i style='color: red'>" + book.lastIndexUpdateTime.substr(0, 11) + "</i>\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
" <div class='book_desc' style=\"margin-top: 5px;color: #a6a6a6;\">简介:" + (book.bookDesc) + "</div>\n" +
|
" <div style=\"margin-top: 5px;color: #a6a6a6;\">简介:" + (book.bookDesc ? (book.bookDesc.length > 15 ? (book.bookDesc.substr(0, 15) + "...") : book.bookDesc) : book.bookDesc) + "</div>\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
|
@ -26,15 +26,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.book_name {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#footer {
|
#footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
|
@ -53,44 +53,6 @@
|
|||||||
color: #3eaf7c;
|
color: #3eaf7c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
overflow-x: auto; /* 允许内容水平滚动 */
|
|
||||||
white-space: nowrap; /* 禁止换行 */
|
|
||||||
scroll-snap-type: x mandatory; /* 在滚动时强制对齐 snap-points */
|
|
||||||
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
||||||
scrollbar-width: none; /* Firefox */
|
|
||||||
}
|
|
||||||
|
|
||||||
.container::-webkit-scrollbar {
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container::-webkit-scrollbar-track,
|
|
||||||
.container::-webkit-scrollbar-thumb {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.item {
|
|
||||||
flex: 0 0 calc(100% / 10); /* 每个元素宽度为容器的十分之一 */
|
|
||||||
scroll-snap-align: start;
|
|
||||||
box-sizing: border-box;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.book_desc {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@ -145,26 +107,26 @@
|
|||||||
精品推荐
|
精品推荐
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<div class="container" style="padding-bottom: 10px">
|
|
||||||
|
|
||||||
<div class="item" style="position: relative;padding:1%;" th:if="${bookMap['4']}" th:each="book,iterStat:${bookMap['4']}">
|
<div class="layui-container" style="padding: 0px">
|
||||||
|
|
||||||
|
<div class="layui-row" style="text-align: center" id="currentWeek" th:if="${bookMap['4']}">
|
||||||
|
<span th:each="book,iterStat : ${bookMap['4']}" th:if="${iterStat.index<3}">
|
||||||
<a th:href="'/book/'+${book.bookId}+'.html'">
|
<a th:href="'/book/'+${book.bookId}+'.html'">
|
||||||
|
<div style="padding: 1%" class="layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
||||||
<img style=" width:100px; height:125px; max-width:100%; max-height:100%;"
|
<img style=" width:100px; height:125px; max-width:100%; max-height:100%;"
|
||||||
th:src="${book.picUrl}">
|
th:src="${book.picUrl}">
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<span style="width: 100px" class="book_name" th:text="${book.bookName}"></span>
|
<span th:text="${#strings.length(book.bookName) > 5}? (${#strings.substring(book.bookName,0,5)}+'...'): ${book.bookName} "></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-colla-item">
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="clear: both"></div>
|
|
||||||
<div class="layui-colla-item">
|
|
||||||
<blockquote class="layui-elem-quote" style="text-align: left;font-size: 16px">
|
<blockquote class="layui-elem-quote" style="text-align: left;font-size: 16px">
|
||||||
热门推荐
|
热门推荐
|
||||||
</blockquote>
|
</blockquote>
|
||||||
@ -174,16 +136,16 @@
|
|||||||
<div th:each="book,iterStat : ${bookMap['3']}" th:if="${iterStat.index<6}" style="margin-bottom: 5px"
|
<div th:each="book,iterStat : ${bookMap['3']}" th:if="${iterStat.index<6}" style="margin-bottom: 5px"
|
||||||
class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4">
|
class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4">
|
||||||
<a th:href="'/book/'+${book.bookId}+'.html'">
|
<a th:href="'/book/'+${book.bookId}+'.html'">
|
||||||
<div class="layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
<div class="layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
||||||
<img style=" width:100px; height:125px;" th:src="${book.picUrl}">
|
<img style=" width:100px; height:125px;" th:src="${book.picUrl}">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-xs8 layui-col-sm8 layui-col-md8 layui-col-lg8">
|
<div class="layui-col-xs5 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
||||||
<ul>
|
<ul>
|
||||||
<li style="padding-bottom: 5px" class="line-limit-length"
|
<li style="padding-bottom: 2px" class="line-limit-length"
|
||||||
th:text="${book.bookName}"></li>
|
th:text="${book.bookName}"></li>
|
||||||
<li style="padding-bottom: 5px;color: #a6a6a6" th:text="'作者:'+${book.authorName}"></li>
|
<li style="padding-bottom: 2px;color: #a6a6a6" th:text="'作者:'+${book.authorName}"></li>
|
||||||
<li class='book_desc' style="color: #a6a6a6;padding-right:10px;"
|
<li style="color: #a6a6a6;width: 180px;height:60px;overflow: hidden"
|
||||||
th:utext="${book.bookDesc}"></li>
|
th:utext="${book.bookDesc}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -197,6 +159,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
<div style="height: 1px" class="layui-col-lg1"></div>
|
<div style="height: 1px" class="layui-col-lg1"></div>
|
||||||
@ -220,6 +184,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
<div th:replace="mobile/common/footer :: footer">
|
<div th:replace="mobile/common/footer :: footer">
|
||||||
@ -261,7 +226,7 @@
|
|||||||
"\n" +
|
"\n" +
|
||||||
" <div style=\"clear: both\"></div>\n" +
|
" <div style=\"clear: both\"></div>\n" +
|
||||||
" <div style=\"color: #a6a6a6;padding-left: 5px;padding-top: 5px\"\n" +
|
" <div style=\"color: #a6a6a6;padding-left: 5px;padding-top: 5px\"\n" +
|
||||||
" class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介:" + updateRankBook.bookDesc + "" +
|
" class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介: " + updateRankBook.bookDesc + "" +
|
||||||
" </div></a>\n" +
|
" </div></a>\n" +
|
||||||
" </div>");
|
" </div>");
|
||||||
|
|
||||||
|
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.2.5</version>
|
<version>5.2.3</version>
|
||||||
<modules>
|
<modules>
|
||||||
<module>novel-common</module>
|
<module>novel-common</module>
|
||||||
<module>novel-front</module>
|
<module>novel-front</module>
|
||||||
|
@ -1,216 +0,0 @@
|
|||||||
<!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>
|
|
@ -1,4 +1,6 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
@ -14,6 +16,8 @@
|
|||||||
|
|
||||||
<div th:include="mobile/common/css :: css"></div>
|
<div th:include="mobile/common/css :: css"></div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
|
|
||||||
|
|
||||||
@ -58,15 +62,6 @@
|
|||||||
height: 180px;
|
height: 180px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.book_desc {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -192,19 +187,19 @@
|
|||||||
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
book.bookDesc = book.bookDesc.replace(/<[^>]+>/g, "").replace(/\s+/g, "").replace(/ /g, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:5px 0px;background: #f2f2f2\">\n" +
|
bookListHtml += ("<div class=\"layui-row\" style=\"margin-bottom:10px;padding:10px;background: #f2f2f2\">\n" +
|
||||||
" <a href=\"/book/" + book.id + ".html\">\n" +
|
" <a href=\"/book/" + book.id + ".html\">\n" +
|
||||||
" <div class=\"layui-col-xs5 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
|
" <div class=\"layui-col-xs6 layui-col-sm3 layui-col-md2 layui-col-lg2\" style=\"text-align: center\">\n" +
|
||||||
" <img style='width: 130px;height: 190px' align=\"center\"\n" +
|
" <img style='width: 130px;height: 180px' align=\"center\"\n" +
|
||||||
" src=\"" + book.picUrl + "\"/>\n" +
|
" src=\"" + book.picUrl + "\"/>\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
" <div style=\"padding: 0px 10px 0px 0px\" class=\"layui-col-xs7 layui-col-sm9 layui-col-md10 layui-col-lg10\">\n" +
|
" <div style=\"padding: 10px\" class=\"layui-col-xs6 layui-col-sm8 layui-col-md8 layui-col-lg8\">\n" +
|
||||||
" <a href=\"/book/" + book.id + ".html\">\n" +
|
" <a href=\"/book/" + book.id + ".html\">\n" +
|
||||||
" <div class=\"line-limit-length\" style=\";color: #000;font-size: 15px\">" + book.bookName + "</div>\n" +
|
" <div class=\"line-limit-length\" style=\";color: #000;font-size: 15px\">" + book.bookName + "</div>\n" +
|
||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
" <div style=\"height: 5px;color: #4c6978;\"><i style=\"color: red\"></i></div>\n" +
|
" <div style=\";color: #4c6978;float: right;\"><i style=\"color: red\"></i></div>\n" +
|
||||||
" <a href=\"/book/book_ranking.html?keyword=" + encodeURI(book.authorName) + "\">\n" +
|
" <a href=\"/book/book_ranking.html?keyword=" + encodeURI(book.authorName) + "\">\n" +
|
||||||
" <div style=\";color: #a6a6a6;\" class=\"line-limit-length\">作者:" + book.authorName + "</div>\n" +
|
" <div style=\";color: #a6a6a6;\" class=\"line-limit-length\">作者:" + book.authorName + "</div>\n" +
|
||||||
" </a>\n" +
|
" </a>\n" +
|
||||||
@ -212,7 +207,7 @@
|
|||||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "</div>\n" +
|
" <div style=\"margin-top: 5px;color: #a6a6a6;\">状态:" + (book.bookStatus == 0 ? '连载' : '完结') + "</div>\n" +
|
||||||
" <div style=\"margin-top: 5px;color: #a6a6a6;\">更新:<i style='color: red'>" + book.lastIndexUpdateTime.substr(0, 11) + "</i>\n" +
|
" <div style=\"margin-top: 5px;color: #a6a6a6;\">更新:<i style='color: red'>" + book.lastIndexUpdateTime.substr(0, 11) + "</i>\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
" <div class='book_desc' style=\"margin-top: 5px;color: #a6a6a6;\">简介:" + (book.bookDesc) + "</div>\n" +
|
" <div style=\"margin-top: 5px;color: #a6a6a6;\">简介:" + (book.bookDesc ? (book.bookDesc.length > 15 ? (book.bookDesc.substr(0, 15) + "...") : book.bookDesc) : book.bookDesc) + "</div>\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
"\n" +
|
"\n" +
|
||||||
" </div>\n" +
|
" </div>\n" +
|
||||||
|
@ -26,15 +26,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.book_name {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
#footer {
|
#footer {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0px;
|
bottom: 0px;
|
||||||
|
@ -53,44 +53,6 @@
|
|||||||
color: #3eaf7c;
|
color: #3eaf7c;
|
||||||
}
|
}
|
||||||
|
|
||||||
.container {
|
|
||||||
display: flex;
|
|
||||||
overflow-x: auto; /* 允许内容水平滚动 */
|
|
||||||
white-space: nowrap; /* 禁止换行 */
|
|
||||||
scroll-snap-type: x mandatory; /* 在滚动时强制对齐 snap-points */
|
|
||||||
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
||||||
scrollbar-width: none; /* Firefox */
|
|
||||||
}
|
|
||||||
|
|
||||||
.container::-webkit-scrollbar {
|
|
||||||
width: 0;
|
|
||||||
height: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container::-webkit-scrollbar-track,
|
|
||||||
.container::-webkit-scrollbar-thumb {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.item {
|
|
||||||
flex: 0 0 calc(100% / 10); /* 每个元素宽度为容器的十分之一 */
|
|
||||||
scroll-snap-align: start;
|
|
||||||
box-sizing: border-box;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 5px;
|
|
||||||
margin-right: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.book_desc {
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-line-clamp: 3;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
|
||||||
@ -145,26 +107,26 @@
|
|||||||
精品推荐
|
精品推荐
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
<div class="container" style="padding-bottom: 10px">
|
|
||||||
|
|
||||||
<div class="item" style="position: relative;padding:1%;" th:if="${bookMap['4']}" th:each="book,iterStat:${bookMap['4']}">
|
<div class="layui-container" style="padding: 0px">
|
||||||
|
|
||||||
|
<div class="layui-row" style="text-align: center" id="currentWeek" th:if="${bookMap['4']}">
|
||||||
|
<span th:each="book,iterStat : ${bookMap['4']}" th:if="${iterStat.index<3}">
|
||||||
<a th:href="'/book/'+${book.bookId}+'.html'">
|
<a th:href="'/book/'+${book.bookId}+'.html'">
|
||||||
|
<div style="padding: 1%" class="layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
||||||
<img style=" width:100px; height:125px; max-width:100%; max-height:100%;"
|
<img style=" width:100px; height:125px; max-width:100%; max-height:100%;"
|
||||||
th:src="${book.picUrl}">
|
th:src="${book.picUrl}">
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<span style="width: 100px" class="book_name" th:text="${book.bookName}"></span>
|
<span th:text="${#strings.length(book.bookName) > 5}? (${#strings.substring(book.bookName,0,5)}+'...'): ${book.bookName} "></span>
|
||||||
|
|
||||||
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="layui-colla-item">
|
||||||
|
|
||||||
</div>
|
|
||||||
<div style="clear: both"></div>
|
|
||||||
<div class="layui-colla-item">
|
|
||||||
<blockquote class="layui-elem-quote" style="text-align: left;font-size: 16px">
|
<blockquote class="layui-elem-quote" style="text-align: left;font-size: 16px">
|
||||||
热门推荐
|
热门推荐
|
||||||
</blockquote>
|
</blockquote>
|
||||||
@ -174,16 +136,16 @@
|
|||||||
<div th:each="book,iterStat : ${bookMap['3']}" th:if="${iterStat.index<6}" style="margin-bottom: 5px"
|
<div th:each="book,iterStat : ${bookMap['3']}" th:if="${iterStat.index<6}" style="margin-bottom: 5px"
|
||||||
class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4">
|
class="layui-col-xs12 layui-col-sm6 layui-col-md4 layui-col-lg4">
|
||||||
<a th:href="'/book/'+${book.bookId}+'.html'">
|
<a th:href="'/book/'+${book.bookId}+'.html'">
|
||||||
<div class="layui-col-xs4 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
<div class="layui-col-xs5 layui-col-sm4 layui-col-md4 layui-col-lg4">
|
||||||
<img style=" width:100px; height:125px;" th:src="${book.picUrl}">
|
<img style=" width:100px; height:125px;" th:src="${book.picUrl}">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-col-xs8 layui-col-sm8 layui-col-md8 layui-col-lg8">
|
<div class="layui-col-xs5 layui-col-sm6 layui-col-md6 layui-col-lg6">
|
||||||
<ul>
|
<ul>
|
||||||
<li style="padding-bottom: 5px" class="line-limit-length"
|
<li style="padding-bottom: 2px" class="line-limit-length"
|
||||||
th:text="${book.bookName}"></li>
|
th:text="${book.bookName}"></li>
|
||||||
<li style="padding-bottom: 5px;color: #a6a6a6" th:text="'作者:'+${book.authorName}"></li>
|
<li style="padding-bottom: 2px;color: #a6a6a6" th:text="'作者:'+${book.authorName}"></li>
|
||||||
<li class='book_desc' style="color: #a6a6a6;padding-right:10px;"
|
<li style="color: #a6a6a6;width: 180px;height:60px;overflow: hidden"
|
||||||
th:utext="${book.bookDesc}"></li>
|
th:utext="${book.bookDesc}"></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@ -197,6 +159,8 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
<div style="height: 1px" class="layui-col-lg1"></div>
|
<div style="height: 1px" class="layui-col-lg1"></div>
|
||||||
@ -220,6 +184,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div style="clear: both"></div>
|
<div style="clear: both"></div>
|
||||||
<div th:replace="mobile/common/footer :: footer">
|
<div th:replace="mobile/common/footer :: footer">
|
||||||
@ -261,7 +226,7 @@
|
|||||||
"\n" +
|
"\n" +
|
||||||
" <div style=\"clear: both\"></div>\n" +
|
" <div style=\"clear: both\"></div>\n" +
|
||||||
" <div style=\"color: #a6a6a6;padding-left: 5px;padding-top: 5px\"\n" +
|
" <div style=\"color: #a6a6a6;padding-left: 5px;padding-top: 5px\"\n" +
|
||||||
" class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介:" + updateRankBook.bookDesc + "" +
|
" class=\"layui-elip layui-col-md11 layui-col-sm11 layui-col-lg11\">简介: " + updateRankBook.bookDesc + "" +
|
||||||
" </div></a>\n" +
|
" </div></a>\n" +
|
||||||
" </div>");
|
" </div>");
|
||||||
|
|
||||||
|
@ -133,52 +133,6 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
},
|
|
||||||
|
|
||||||
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) {
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user