修复笔趣塔分类更新错误的问题

This commit is contained in:
xiongxiaoyang 2019-12-11 11:45:07 +08:00
parent 66753cb0d4
commit 3dcabd3cf3
10 changed files with 338 additions and 311 deletions

View File

@ -0,0 +1,27 @@
package xyz.zinglizingli.books.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
/**
* 图片保存类型
* @author 11797
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public enum PicSaveType {
/**
* 使用网络图片不保存
* */
NETWORK(1),
/**
* 本地保存
* */
LOCAL(2);
private int value;
}

View File

@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import tk.mybatis.orderbyhelper.OrderByHelper; import tk.mybatis.orderbyhelper.OrderByHelper;
import xyz.zinglizingli.books.constant.CacheKeyConstans; import xyz.zinglizingli.books.constant.CacheKeyConstans;
import xyz.zinglizingli.books.enums.PicSaveType;
import xyz.zinglizingli.books.mapper.*; import xyz.zinglizingli.books.mapper.*;
import xyz.zinglizingli.books.po.*; import xyz.zinglizingli.books.po.*;
import xyz.zinglizingli.books.util.UUIDUtils; import xyz.zinglizingli.books.util.UUIDUtils;
@ -27,6 +28,7 @@ import java.io.FileOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* @author XXY * @author XXY
@ -49,7 +51,7 @@ public class BookService {
private final CommonCacheUtil cacheUtil; private final CommonCacheUtil cacheUtil;
@Value("${pic.save.type}") @Value("${pic.save.type}")
private Byte picSaveType; private Integer picSaveType;
@Value("${pic.save.path}") @Value("${pic.save.path}")
private String picSavePath; private String picSavePath;
@ -71,45 +73,15 @@ public class BookService {
if (books.size() > 0) { if (books.size() > 0) {
//更新 //更新
bookId = books.get(0).getId(); bookId = books.get(0).getId();
book.setId(bookId); updateBook(book, bookId);
String picSrc = book.getPicUrl();
if(picSaveType == 2 && StringUtils.isNotBlank(picSrc)){
try {
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<Resource> resEntity = RestTemplateUtil.getInstance(Charsets.ISO_8859_1).exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
InputStream input = Objects.requireNonNull(resEntity.getBody()).getInputStream();
Date currentDate = new Date();
picSrc = "/localPic/" + DateUtils.formatDate(currentDate, "yyyy") + "/" + DateUtils.formatDate(currentDate, "MM") + "/" + DateUtils.formatDate(currentDate, "dd")
+ UUIDUtils.getUUID32()
+ picSrc.substring(picSrc.lastIndexOf("."));
File picFile = new File(picSavePath + picSrc);
File parentFile = picFile.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
OutputStream out = new FileOutputStream(picFile);
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1; ) {
out.write(b, 0, n);
}
out.close();
input.close();
book.setPicUrl(picSrc);
}catch (Exception e){
log.error(e.getMessage(),e);
}
}
bookMapper.updateByPrimaryKeySelective(book);
isUpdate = true; isUpdate = true;
} else { } else {
//插入
if (book.getVisitCount() == null) { if (book.getVisitCount() == null) {
Long visitCount = generateVisiteCount(book.getScore()); Long visitCount = generateVisitCount(book.getScore());
book.setVisitCount(visitCount); book.setVisitCount(visitCount);
} }
//插入
int rows = bookMapper.insertSelective(book); int rows = bookMapper.insertSelective(book);
if (rows > 0) { if (rows > 0) {
bookId = book.getId(); bookId = book.getId();
@ -159,6 +131,44 @@ public class BookService {
} }
/**
* 更新书籍
* */
private void updateBook(Book book, Long bookId) {
book.setId(bookId);
String picSrc = book.getPicUrl();
if(picSaveType == PicSaveType.LOCAL.getValue() && StringUtils.isNotBlank(picSrc)){
try {
//本地图片保存
HttpHeaders headers = new HttpHeaders();
HttpEntity<String> requestEntity = new HttpEntity<>(null, headers);
ResponseEntity<Resource> resEntity = RestTemplateUtil.getInstance(Charsets.ISO_8859_1).exchange(picSrc, HttpMethod.GET, requestEntity, Resource.class);
InputStream input = Objects.requireNonNull(resEntity.getBody()).getInputStream();
Date currentDate = new Date();
picSrc = "/localPic/" + DateUtils.formatDate(currentDate, "yyyy") + "/" + DateUtils.formatDate(currentDate, "MM") + "/" + DateUtils.formatDate(currentDate, "dd")
+ UUIDUtils.getUUID32()
+ picSrc.substring(picSrc.lastIndexOf("."));
File picFile = new File(picSavePath + picSrc);
File parentFile = picFile.getParentFile();
if (!parentFile.exists()) {
parentFile.mkdirs();
}
OutputStream out = new FileOutputStream(picFile);
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1; ) {
out.write(b, 0, n);
}
out.close();
input.close();
book.setPicUrl(picSrc);
}catch (Exception e){
log.error(e.getMessage(),e);
}
}
bookMapper.updateByPrimaryKeySelective(book);
}
/** /**
* 批量插入章节目录表和章节内容表 * 批量插入章节目录表和章节内容表
* */ * */
@ -172,7 +182,7 @@ public class BookService {
/** /**
* 生成随机访问次数 * 生成随机访问次数
* */ * */
private Long generateVisiteCount(Float score) { private Long generateVisitCount(Float score) {
int baseNum = (int)(score * 100); int baseNum = (int)(score * 100);
return Long.parseLong(baseNum + new Random().nextInt(1000) + ""); return Long.parseLong(baseNum + new Random().nextInt(1000) + "");
} }
@ -340,10 +350,9 @@ public class BookService {
} }
/** /**
* 查询该书籍目录数量 * 查询该书籍已存在目录号
*/ */
public List<Integer> queryIndexCountByBookNameAndAuthor(String bookName, String author) { public List<Integer> queryIndexNumByBookNameAndAuthor(String bookName, String author) {
List<Integer> result = new ArrayList<>();
BookExample example = new BookExample(); BookExample example = new BookExample();
example.createCriteria().andBookNameEqualTo(bookName).andAuthorEqualTo(author); example.createCriteria().andBookNameEqualTo(bookName).andAuthorEqualTo(author);
List<Book> books = bookMapper.selectByExample(example); List<Book> books = bookMapper.selectByExample(example);
@ -353,15 +362,13 @@ public class BookService {
BookIndexExample bookIndexExample = new BookIndexExample(); BookIndexExample bookIndexExample = new BookIndexExample();
bookIndexExample.createCriteria().andBookIdEqualTo(bookId); bookIndexExample.createCriteria().andBookIdEqualTo(bookId);
List<BookIndex> bookIndices = bookIndexMapper.selectByExample(bookIndexExample); List<BookIndex> bookIndices = bookIndexMapper.selectByExample(bookIndexExample);
if (bookIndices != null && bookIndices.size() > 0) { if(bookIndices.size()>0) {
for (BookIndex bookIndex : bookIndices) { return bookIndices.stream().map(BookIndex::getIndexNum).collect(Collectors.toList());
result.add(bookIndex.getIndexNum());
}
} }
} }
return result; return new ArrayList<>(0);
} }
@ -494,15 +501,6 @@ public class BookService {
} }
/**
* 查询完本书籍
* */
public List<String> queryEndBookIdList() {
return bookMapper.queryEndBookIdList();
}
/** /**

View File

@ -20,8 +20,8 @@ import xyz.zinglizingli.books.service.BookService;
import xyz.zinglizingli.books.service.UserService; import xyz.zinglizingli.books.service.UserService;
import xyz.zinglizingli.books.vo.BookVO; import xyz.zinglizingli.books.vo.BookVO;
import xyz.zinglizingli.common.cache.CommonCacheUtil; import xyz.zinglizingli.common.cache.CommonCacheUtil;
import xyz.zinglizingli.common.utils.Constants;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession; import javax.servlet.http.HttpSession;
import java.io.OutputStream; import java.io.OutputStream;
@ -31,6 +31,7 @@ import java.util.*;
/** /**
* 小说Controller * 小说Controller
*
* @author 11797 * @author 11797
*/ */
@Controller @Controller
@ -46,66 +47,63 @@ public class BookController {
private final CommonCacheUtil commonCacheUtil; private final CommonCacheUtil commonCacheUtil;
/** /**
* 精品小说搜索页 * 精品小说搜索页
* */ */
@RequestMapping("search") @RequestMapping("search")
public String search(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize, public String search(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", required = false) Integer catId, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", required = false) Integer catId,
@RequestParam(value = "historyBookIds", required = false) String ids, @RequestParam(value = "historyBookIds", required = false) String ids,
@RequestParam(value = "bookStatus", required = false) String bookStatus, @RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "token", required = false) String token, @RequestParam(value = "token", required = false) String token,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort, @RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy,
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) { @RequestParam(value = "sort", defaultValue = "DESC") String sort, ModelMap modelMap) {
String userId = null; String userId = null;
String titleType = "最近更新"; String titleType = "最近更新";
if (catId != null) { if (catId != null) {
titleType = bookService.getCatNameById(catId) + "分类频道"; titleType = bookService.getCatNameById(catId) + "分类频道";
; } else if (Constants.NOVEL_TOP_FIELD.equals(sortBy)) {
} else if ("score".equals(sortBy)) {
titleType = "小说排行"; titleType = "小说排行";
} else if (ids != null) { } else if (ids != null) {
titleType = "阅读记录"; titleType = "阅读记录";
} else if (token != null) { } else if (token != null) {
userId = commonCacheUtil.get(token); userId = commonCacheUtil.get(token);
titleType = "我的书架"; titleType = "我的书架";
} else if (bookStatus != null && bookStatus.contains("完成")) { } else if (bookStatus != null && bookStatus.contains(Constants.NOVEL_END_TAG)) {
titleType = "完本小说"; titleType = "完本小说";
} else if (keyword != null) { } else if (keyword != null) {
titleType = "搜索"; titleType = "搜索";
} }
modelMap.put("titleType", titleType); modelMap.put("titleType", titleType);
List<Book> books; List<Book> books;
List<BookVO> bookVOList; List<BookVO> bookVoList;
if (StringUtils.isEmpty(ids) || !StringUtils.isEmpty(keyword)) { if (StringUtils.isEmpty(ids) || !StringUtils.isEmpty(keyword)) {
books = bookService.search(page, pageSize, userId, ids, keyword, bookStatus, catId, null, null, sortBy, sort); books = bookService.search(page, pageSize, userId, ids, keyword, bookStatus, catId, null, null, sortBy, sort);
bookVOList = new ArrayList<>(); bookVoList = new ArrayList<>();
for (Book book : books) { for (Book book : books) {
BookVO bookvo = new BookVO(); BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo); BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid())); bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
bookVOList.add(bookvo); bookVoList.add(bookvo);
} }
} else { } else {
if (!ids.contains("-")) { if (!ids.contains(Constants.BOOK_ID_SEPARATOR)) {
books = bookService.search(page, 50, userId, ids, keyword, null, catId, null, null, sortBy, sort); books = bookService.search(page, 50, null, ids, keyword, null, catId, null, null, sortBy, sort);
List<String> idsArr = Arrays.asList(ids.split(",")); List<String> idsArr = Arrays.asList(ids.split(","));
int length = idsArr.size(); BookVO[] bookVoArr = new BookVO[books.size()];
BookVO[] bookVOArr = new BookVO[books.size()];
for (Book book : books) { for (Book book : books) {
int index = idsArr.indexOf(book.getId() + ""); int index = idsArr.indexOf(book.getId() + "");
BookVO bookvo = new BookVO(); BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo); BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid())); bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
bookVOArr[books.size() - index - 1] = bookvo; bookVoArr[books.size() - index - 1] = bookvo;
} }
bookVOList = Arrays.asList(bookVOArr); bookVoList = Arrays.asList(bookVoArr);
} else { } else {
books = new ArrayList<>(); books = new ArrayList<>();
bookVOList = new ArrayList<>(); bookVoList = new ArrayList<>();
} }
} }
@ -114,7 +112,7 @@ public class BookController {
modelMap.put("limit", bookPageInfo.getPageSize()); modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum()); modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal()); modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList); modelMap.put("books", bookVoList);
modelMap.put("ids", ids); modelMap.put("ids", ids);
modelMap.put("token", token); modelMap.put("token", token);
modelMap.put("bookStatus", bookStatus); modelMap.put("bookStatus", bookStatus);
@ -127,26 +125,31 @@ public class BookController {
/** /**
* 轻小说搜索页 * 轻小说或漫画搜索页
* */ */
@RequestMapping("searchSoftBook.html") @RequestMapping("searchSoftBook.html")
public String searchSoftBook(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize, public String searchSoftBook(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", defaultValue = "8") Integer catId, @RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", defaultValue = "8") Integer catId,
@RequestParam(value = "softCat", required = false) Integer softCat, @RequestParam(value = "softCat", required = false) Integer softCat,
@RequestParam(value = "bookStatus", required = false) String bookStatus, @RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "softTag", required = false) String softTag, @RequestParam(value = "softTag", required = false) String softTag,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort, @RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy,
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) { @RequestParam(value = "sort", defaultValue = "DESC") String sort, ModelMap modelMap) {
String userId = null; List<Book> books = bookService.search(page, pageSize, null, null, keyword, bookStatus, catId, softCat, softTag, sortBy, sort);
List<Book> books = bookService.search(page, pageSize, userId, null, keyword, bookStatus, catId, softCat, softTag, sortBy, sort); List<BookVO> bookVoList;
List<BookVO> bookVOList; bookVoList = new ArrayList<>();
bookVOList = new ArrayList<>();
for (Book book : books) { for (Book book : books) {
BookVO bookvo = new BookVO(); BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo); BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getSoftCatNameById(bookvo.getSoftCat())); if(catId == Constants.SOFT_NOVEL_CAT) {
bookVOList.add(bookvo); //轻小说
bookvo.setCateName(bookService.getSoftCatNameById(bookvo.getSoftCat()));
}else if(catId == Constants.MH_NOVEL_CAT){
//漫画
bookvo.setCateName(bookService.getMhCatNameById(bookvo.getSoftCat()));
}
bookVoList.add(bookvo);
} }
@ -154,64 +157,34 @@ public class BookController {
modelMap.put("limit", bookPageInfo.getPageSize()); modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum()); modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal()); modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList); modelMap.put("books", bookVoList);
modelMap.put("keyword", keyword); modelMap.put("keyword", keyword);
modelMap.put("bookStatus", bookStatus); modelMap.put("bookStatus", bookStatus);
modelMap.put("softCat", softCat); modelMap.put("softCat", softCat);
modelMap.put("softTag", softTag); modelMap.put("softTag", softTag);
modelMap.put("sortBy", sortBy); modelMap.put("sortBy", sortBy);
modelMap.put("sort", sort); modelMap.put("sort", sort);
return "books/soft_book_search"; if(catId == Constants.SOFT_NOVEL_CAT){
} //轻小说
return "books/soft_book_search";
/** }else if(catId == Constants.MH_NOVEL_CAT){
* 漫画搜索页 //漫画
* */ return "books/mh_book_search";
@RequestMapping("searchMhBook.html")
public String searchMhBook(@RequestParam(value = "curr", defaultValue = "1") int page, @RequestParam(value = "limit", defaultValue = "20") int pageSize,
@RequestParam(value = "keyword", required = false) String keyword, @RequestParam(value = "catId", defaultValue = "9") Integer catId,
@RequestParam(value = "softCat", required = false) Integer softCat,
@RequestParam(value = "bookStatus", required = false) String bookStatus,
@RequestParam(value = "softTag", required = false) String softTag,
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort,
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) {
String userId = null;
List<Book> books = bookService.search(page, pageSize, userId, null, keyword, bookStatus, catId, softCat, softTag, sortBy, sort);
List<BookVO> bookVOList;
bookVOList = new ArrayList<>();
for (Book book : books) {
BookVO bookvo = new BookVO();
BeanUtils.copyProperties(book, bookvo);
bookvo.setCateName(bookService.getMhCatNameById(bookvo.getSoftCat()));
bookVOList.add(bookvo);
} }
return null;
PageInfo<Book> bookPageInfo = new PageInfo<>(books);
modelMap.put("limit", bookPageInfo.getPageSize());
modelMap.put("curr", bookPageInfo.getPageNum());
modelMap.put("total", bookPageInfo.getTotal());
modelMap.put("books", bookVOList);
modelMap.put("keyword", keyword);
modelMap.put("bookStatus", bookStatus);
modelMap.put("softCat", softCat);
modelMap.put("softTag", softTag);
modelMap.put("sortBy", sortBy);
modelMap.put("sort", sort);
return "books/mh_book_search";
} }
/** /**
* 书籍详情页 * 书籍详情页
* */ */
@RequestMapping("{bookId}.html") @RequestMapping("{bookId}.html")
public String detail(@PathVariable("bookId") Long bookId, @RequestParam(value = "token",required = false)String token, ModelMap modelMap) { public String detail(@PathVariable("bookId") Long bookId, @RequestParam(value = "token", required = false) String token, ModelMap modelMap) {
String userId = commonCacheUtil.get(token); String userId = commonCacheUtil.get(token);
if(org.apache.commons.lang3.StringUtils.isNotBlank(userId)){ if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
Integer indexNumber = userService.queryBookIndexNumber(userId,bookId); Integer indexNumber = userService.queryBookIndexNumber(userId, bookId);
if(indexNumber!=null){ if (indexNumber != null) {
return "redirect:/book/"+bookId+"/"+indexNumber+".html"; return "redirect:/book/" + bookId + "/" + indexNumber + ".html";
} }
} }
@ -246,7 +219,7 @@ public class BookController {
/** /**
* 书籍目录页 * 书籍目录页
* */ */
@RequestMapping("{bookId}/index.html") @RequestMapping("{bookId}/index.html")
public String bookIndex(@PathVariable("bookId") Long bookId, ModelMap modelMap) { public String bookIndex(@PathVariable("bookId") Long bookId, ModelMap modelMap) {
List<BookIndex> indexList = bookService.queryAllIndexList(bookId); List<BookIndex> indexList = bookService.queryAllIndexList(bookId);
@ -260,7 +233,7 @@ public class BookController {
/** /**
* 书籍内容页 * 书籍内容页
* */ */
@RequestMapping("{bookId}/{indexNum}.html") @RequestMapping("{bookId}/{indexNum}.html")
public String bookContent(@PathVariable("bookId") Long bookId, @PathVariable("indexNum") Integer indexNum, ModelMap modelMap) { public String bookContent(@PathVariable("bookId") Long bookId, @PathVariable("indexNum") Integer indexNum, ModelMap modelMap) {
BookContent bookContent = bookService.queryBookContent(bookId, indexNum); BookContent bookContent = bookService.queryBookContent(bookId, indexNum);
@ -278,11 +251,11 @@ public class BookController {
List<Integer> preAndNextIndexNum = bookService.queryPreAndNextIndexNum(bookId, indexNum); List<Integer> preAndNextIndexNum = bookService.queryPreAndNextIndexNum(bookId, indexNum);
modelMap.put("nextIndexNum", preAndNextIndexNum.get(0)); modelMap.put("nextIndexNum", preAndNextIndexNum.get(0));
modelMap.put("preIndexNum", preAndNextIndexNum.get(1)); modelMap.put("preIndexNum", preAndNextIndexNum.get(1));
bookContent.setContent(bookContent.getContent().replaceAll("<div[^>]+app\\.html[^>]+>\\s*<div[^>]+>\\s*<div[^>]+>[^<]+</div>\\s*<div[^>]+>[^<]+<span[^>]+>>>[^<]+<<</span>\\s*</div>\\s*</div>\\s*</div>","")); bookContent.setContent(bookContent.getContent().replaceAll("<div[^>]+app\\.html[^>]+>\\s*<div[^>]+>\\s*<div[^>]+>[^<]+</div>\\s*<div[^>]+>[^<]+<span[^>]+>>>[^<]+<<</span>\\s*</div>\\s*</div>\\s*</div>", ""));
modelMap.put("bookContent", bookContent); modelMap.put("bookContent", bookContent);
modelMap.put("indexName", indexName); modelMap.put("indexName", indexName);
Book basicBook = bookService.queryBaseInfo(bookId); Book basicBook = bookService.queryBaseInfo(bookId);
if(basicBook.getCatid() < 8) { if (basicBook.getCatid() <= Constants.MAX_NOVEL_CAT) {
bookContent.setContent(StringEscapeUtils.unescapeHtml4(bookContent.getContent())); bookContent.setContent(StringEscapeUtils.unescapeHtml4(bookContent.getContent()));
} }
String bookName = basicBook.getBookName(); String bookName = basicBook.getBookName();
@ -295,24 +268,24 @@ public class BookController {
/** /**
* 增加访问次数 * 增加访问次数
* */ */
@RequestMapping("addVisit") @RequestMapping("addVisit")
@ResponseBody @ResponseBody
public String addVisit(@RequestParam("bookId") Long bookId,@RequestParam(value = "indexNum",defaultValue = "0") Integer indexNum,@RequestParam(value = "token",defaultValue = "") String token) { public String addVisit(@RequestParam("bookId") Long bookId, @RequestParam(value = "indexNum", defaultValue = "0") Integer indexNum, @RequestParam(value = "token", defaultValue = "") String token) {
String userId = commonCacheUtil.get(token); String userId = commonCacheUtil.get(token);
bookService.addVisitCount(bookId,userId,indexNum); bookService.addVisitCount(bookId, userId, indexNum);
return "ok"; return "ok";
} }
/** /**
* 发送弹幕 * 发送弹幕
* */ */
@RequestMapping("sendBullet") @RequestMapping("sendBullet")
@ResponseBody @ResponseBody
public Map<String, Object> sendBullet(@RequestParam("contentId") Long contentId, @RequestParam("bullet") String bullet) { public Map<String, Object> sendBullet(@RequestParam("contentId") Long contentId, @RequestParam("bullet") String bullet) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>(2);
bookService.sendBullet(contentId, bullet); bookService.sendBullet(contentId, bullet);
result.put("code", 1); result.put("code", 1);
result.put("desc", "ok"); result.put("desc", "ok");
@ -321,12 +294,12 @@ public class BookController {
/** /**
* 查询是否正在下载 * 查询是否正在下载
* */ */
@RequestMapping("queryIsDownloading") @RequestMapping("queryIsDownloading")
@ResponseBody @ResponseBody
public Map<String, Object> queryIsDownloading(HttpSession session) { public Map<String, Object> queryIsDownloading(HttpSession session) {
Map<String, Object> result = new HashMap<>(); Map<String, Object> result = new HashMap<>(1);
if (session.getAttribute("isDownloading") != null) { if (session.getAttribute(Constants.NOVEL_IS_DOWNLOADING_KEY) != null) {
result.put("code", 1); result.put("code", 1);
} else { } else {
result.put("code", 0); result.put("code", 0);
@ -337,7 +310,7 @@ public class BookController {
/** /**
* 查询弹幕 * 查询弹幕
* */ */
@RequestMapping("queryBullet") @RequestMapping("queryBullet")
@ResponseBody @ResponseBody
public List<ScreenBullet> queryBullet(@RequestParam("contentId") Long contentId) { public List<ScreenBullet> queryBullet(@RequestParam("contentId") Long contentId) {
@ -352,7 +325,7 @@ public class BookController {
@RequestMapping(value = "/download") @RequestMapping(value = "/download")
public void download(@RequestParam("bookId") Long bookId, @RequestParam("bookName") String bookName, HttpServletResponse resp, HttpSession session) { public void download(@RequestParam("bookId") Long bookId, @RequestParam("bookName") String bookName, HttpServletResponse resp, HttpSession session) {
try { try {
session.setAttribute("isDownloading", 1); session.setAttribute(Constants.NOVEL_IS_DOWNLOADING_KEY, 1);
int count = bookService.countIndex(bookId); int count = bookService.countIndex(bookId);
@ -365,19 +338,19 @@ public class BookController {
if (count > 0) { if (count > 0) {
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
String index = bookService.queryIndexNameByBookIdAndIndexNum(bookId, i); String index = bookService.queryIndexNameByBookIdAndIndexNum(bookId, i);
if(index != null) { if (index != null) {
String content = bookService.queryContentList(bookId, i); String content = bookService.queryContentList(bookId, i);
out.write(index.getBytes(StandardCharsets.UTF_8)); out.write(index.getBytes(StandardCharsets.UTF_8));
out.write("\n".getBytes(StandardCharsets.UTF_8)); out.write("\n".getBytes(StandardCharsets.UTF_8));
content = content.replaceAll("<br\\s*/*>", "\r\n"); content = content.replaceAll("<br\\s*/*>", "\r\n")
content = content.replaceAll("&nbsp;", " "); .replaceAll("&nbsp;", " ")
content = content.replaceAll("<a[^>]*>", ""); .replaceAll("<a[^>]*>", "")
content = content.replaceAll("</a>", ""); .replaceAll("</a>", "")
content = content.replaceAll("<div[^>]*>", ""); .replaceAll("<div[^>]*>", "")
content = content.replaceAll("</div>", ""); .replaceAll("</div>", "")
content = content.replaceAll("<p[^>]*>[^<]*<a[^>]*>[^<]*</a>\\s*</p>", ""); .replaceAll("<p[^>]*>[^<]*<a[^>]*>[^<]*</a>\\s*</p>", "")
content = content.replaceAll("<p[^>]*>", ""); .replaceAll("<p[^>]*>", "")
content = content.replaceAll("</p>", "\r\n"); .replaceAll("</p>", "\r\n");
out.write(content.getBytes(StandardCharsets.UTF_8)); out.write(content.getBytes(StandardCharsets.UTF_8));
out.write("\r\n".getBytes(StandardCharsets.UTF_8)); out.write("\r\n".getBytes(StandardCharsets.UTF_8));
out.write("\r\n".getBytes(StandardCharsets.UTF_8)); out.write("\r\n".getBytes(StandardCharsets.UTF_8));
@ -393,7 +366,7 @@ public class BookController {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally { } finally {
session.removeAttribute("isDownloading"); session.removeAttribute(Constants.NOVEL_IS_DOWNLOADING_KEY);
} }
} }

View File

@ -7,44 +7,30 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import xyz.zinglizingli.common.cache.CommonCacheUtil; import xyz.zinglizingli.common.cache.CommonCacheUtil;
/**
* @author 11797
*/
@Service @Service
public class EHCacheUtil implements CommonCacheUtil { public class EhCacheUtil implements CommonCacheUtil {
@Autowired @Autowired
private CacheManager cacheManager ; private CacheManager cacheManager ;
private static final String CACHE_NAME = "utilCache"; private static final String CACHE_NAME = "util_cache";
/** /**
* 获得一个Cache没有则创建一个 * 获得一个Cache没有则创建一个
* @param cacheName
* @return * @return
*/ */
private Cache getCache(){ private Cache getCache(){
/*Cache cache = cacheManager.getCache(cacheName); Cache cache = cacheManager.getCache(CACHE_NAME);
if (cache == null){
cacheManager.addCache(cacheName);
cache = cacheManager.getCache(cacheName);
CacheConfiguration config = cache.getCacheConfiguration();
config.setEternal(false);
config.internalSetTimeToIdle(0);
config.internalSetTimeToIdle(0);
}*/
Cache cache = cacheManager.getCache("util_cache");
return cache; return cache;
} }
public CacheManager getCacheManager() {
return cacheManager;
}
@Override @Override
public String get(String key) { public String get(String key) {
Element element = getCache().get(key); Element element = getCache().get(key);
@ -55,7 +41,8 @@ public class EHCacheUtil implements CommonCacheUtil {
public void set(String key, String value) { public void set(String key, String value) {
Element element = new Element(key, value); Element element = new Element(key, value);
Cache cache = getCache(); Cache cache = getCache();
cache.getCacheConfiguration().setEternal(true);//不过期 //不过期
cache.getCacheConfiguration().setEternal(true);
cache.put(element); cache.put(element);
} }
@ -106,13 +93,13 @@ public class EHCacheUtil implements CommonCacheUtil {
/** /**
* 设置Object类型的缓存 * 设置Object类型的缓存
* @param <T>
*/ */
@Override @Override
public void setObject(String key, Object value) { public void setObject(String key, Object value) {
Element element = new Element(key, value); Element element = new Element(key, value);
Cache cache = getCache(); Cache cache = getCache();
cache.getCacheConfiguration().setEternal(true);//不过期 //不过期
cache.getCacheConfiguration().setEternal(true);
cache.put(element); cache.put(element);
} }
@ -131,6 +118,9 @@ public class EHCacheUtil implements CommonCacheUtil {
} }
/**
* 刷新过期时间
* */
@Override @Override
public void refresh(String key) { public void refresh(String key) {
Element element = getCache().get(key); Element element = getCache().get(key);

View File

@ -46,10 +46,6 @@ public class CrawlBooksSchedule {
@Value("${crawl.website.type}") @Value("${crawl.website.type}")
private Byte websiteType; private Byte websiteType;
@Value("${pic.save.type}")
private Byte picSaveType;
@Value("${pic.save.path}") @Value("${pic.save.path}")
private String picSavePath; private String picSavePath;
@ -96,7 +92,7 @@ public class CrawlBooksSchedule {
if (isFind) { if (isFind) {
//解析第一页书籍的数据 //解析第一页书籍的数据
Pattern bookPatten = compile("href=\"/(\\d+_\\d+)/\""); Pattern bookPatten = compile("href=\"/(\\d+_\\d+)/\"");
parseBiquTaBook(bookPatten, forObject, bookClass, baseUrl); parseBiquTaBook(bookPatten, forObject, baseUrl);
} }
} }
} }
@ -104,7 +100,7 @@ public class CrawlBooksSchedule {
/** /**
* 解析笔趣塔数据 * 解析笔趣塔数据
*/ */
private void parseBiquTaBook(Pattern bookPatten, String forObject, int catNum, String baseUrl) { private void parseBiquTaBook(Pattern bookPatten, String forObject, String baseUrl) {
Matcher bookMatcher = bookPatten.matcher(forObject); Matcher bookMatcher = bookPatten.matcher(forObject);
boolean isFind = bookMatcher.find(); boolean isFind = bookMatcher.find();
@ -142,108 +138,112 @@ public class CrawlBooksSchedule {
if (statusMatch.find()) { if (statusMatch.find()) {
String status = statusMatch.group(1); String status = statusMatch.group(1);
Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>"); Pattern catPatten = compile("类别:([^/]+)</li>");
Matcher updateTimeMatch = updateTimePatten.matcher(body); Matcher catMatch = catPatten.matcher(body);
if (updateTimeMatch.find()) { if (catMatch.find()) {
String updateTimeStr = updateTimeMatch.group(1); String catName = catMatch.group(1);
SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss"); int catNum = getCatNum(catName);
Date updateTime = format.parse(updateTimeStr);
Pattern picPatten = compile("<img src=\"([^>]+)\"\\s+onerror=\"this.src=");
Matcher picMather = picPatten.matcher(body);
if (picMather.find()) {
String picSrc = picMather.group(1);
Pattern descPatten = compile("class=\"review\">([^<]+)</p>"); Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
Matcher descMatch = descPatten.matcher(body); Matcher updateTimeMatch = updateTimePatten.matcher(body);
if (descMatch.find()) { if (updateTimeMatch.find()) {
String desc = descMatch.group(1); String updateTimeStr = updateTimeMatch.group(1);
SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss");
Date updateTime = format.parse(updateTimeStr);
Pattern picPatten = compile("<img src=\"([^>]+)\"\\s+onerror=\"this.src=");
Matcher picMather = picPatten.matcher(body);
if (picMather.find()) {
String picSrc = picMather.group(1);
Book book = new Book(); Pattern descPatten = compile("class=\"review\">([^<]+)</p>");
book.setAuthor(author); Matcher descMatch = descPatten.matcher(body);
book.setCatid(catNum); if (descMatch.find()) {
book.setBookDesc(desc); String desc = descMatch.group(1);
book.setBookName(bookName);
book.setScore(score > 10 ? 8.0f : score);
book.setPicUrl(picSrc);
book.setBookStatus(status);
book.setUpdateTime(updateTime);
List<BookIndex> indexList = new ArrayList<>();
List<BookContent> contentList = new ArrayList<>();
//读取目录
Pattern indexPatten = compile("<a\\s+href=\"(/du/\\d+_\\d+/)\">查看完整目录</a>");
Matcher indexMatch = indexPatten.matcher(body);
if (indexMatch.find()) {
String indexUrl = baseUrl + indexMatch.group(1);
String body2 = getByRestTemplate(indexUrl);
if (body2 != null) {
Pattern indexListPatten = compile("<a\\s+style=\"\"\\s+href=\"(/\\d+_\\d+/\\d+\\.html)\">([^/]+)</a>");
Matcher indexListMatch = indexListPatten.matcher(body2);
boolean isFindIndex = indexListMatch.find();
int indexNum = 0;
//查询该书籍已存在目录号
List<Integer> hasIndexNum = bookService.queryIndexCountByBookNameAndAuthor(bookName, author);
//更新和插入分别开插入只在凌晨做一次
if (hasIndexNum.size() > 0) {
while (isFindIndex) {
if (!hasIndexNum.contains(indexNum)) {
String contentUrl = baseUrl + indexListMatch.group(1);
String indexName = indexListMatch.group(2);
//查询章节内容 Book book = new Book();
String body3 = getByRestTemplate(contentUrl); book.setAuthor(author);
if (body3 != null) { book.setCatid(catNum);
String start = "『章节错误,点此举报』"; book.setBookDesc(desc);
String end = "『加入书签,方便阅读』"; book.setBookName(bookName);
String content = body3.substring(body3.indexOf(start) + start.length(), body3.indexOf(end)); book.setScore(score > 10 ? 8.0f : score);
//TODO插入章节目录和章节内容 book.setPicUrl(picSrc);
BookIndex bookIndex = new BookIndex(); book.setBookStatus(status);
bookIndex.setIndexName(indexName); book.setUpdateTime(updateTime);
bookIndex.setIndexNum(indexNum);
indexList.add(bookIndex); List<BookIndex> indexList = new ArrayList<>();
BookContent bookContent = new BookContent(); List<BookContent> contentList = new ArrayList<>();
bookContent.setContent(content);
bookContent.setIndexNum(indexNum); //读取目录
contentList.add(bookContent); Pattern indexPatten = compile("<a\\s+href=\"(/du/\\d+_\\d+/)\">查看完整目录</a>");
Matcher indexMatch = indexPatten.matcher(body);
if (indexMatch.find()) {
String indexUrl = baseUrl + indexMatch.group(1);
String body2 = getByRestTemplate(indexUrl);
if (body2 != null) {
Pattern indexListPatten = compile("<a\\s+style=\"\"\\s+href=\"(/\\d+_\\d+/\\d+\\.html)\">([^/]+)</a>");
Matcher indexListMatch = indexListPatten.matcher(body2);
boolean isFindIndex = indexListMatch.find();
int indexNum = 0;
//查询该书籍已存在目录号
List<Integer> hasIndexNum = bookService.queryIndexNumByBookNameAndAuthor(bookName, author);
//更新和插入分别开插入只在凌晨做一次
if (hasIndexNum.size() > 0) {
while (isFindIndex) {
if (!hasIndexNum.contains(indexNum)) {
String contentUrl = baseUrl + indexListMatch.group(1);
String indexName = indexListMatch.group(2);
//查询章节内容
String body3 = getByRestTemplate(contentUrl);
if (body3 != null) {
String start = "『章节错误,点此举报』";
String end = "『加入书签,方便阅读』";
String content = body3.substring(body3.indexOf(start) + start.length(), body3.indexOf(end));
//TODO插入章节目录和章节内容
BookIndex bookIndex = new BookIndex();
bookIndex.setIndexName(indexName);
bookIndex.setIndexNum(indexNum);
indexList.add(bookIndex);
BookContent bookContent = new BookContent();
bookContent.setContent(content);
bookContent.setIndexNum(indexNum);
contentList.add(bookContent);
} else {
break;
}
} else {
break;
} }
indexNum++;
isFindIndex = indexListMatch.find();
}
if (indexList.size() == contentList.size() && indexList.size() > 0) {
ExcutorUtils.excuteFixedTask(() ->
bookService.saveBookAndIndexAndContent(book, indexList, contentList)
);
} }
indexNum++;
isFindIndex = indexListMatch.find();
}
if (indexList.size() == contentList.size() && indexList.size() > 0) {
ExcutorUtils.excuteFixedTask(new Runnable() {
@Override
public void run() {
bookService.saveBookAndIndexAndContent(book, indexList, contentList);
}
});
} }
} }
} }
} }
} }
} }
} }
} }
@ -340,37 +340,7 @@ public class CrawlBooksSchedule {
Matcher catMatch = catPatten.matcher(body); Matcher catMatch = catPatten.matcher(body);
if (catMatch.find()) { if (catMatch.find()) {
String catName = catMatch.group(1); String catName = catMatch.group(1);
int catNum; int catNum = getCatNum(catName);
switch (catName) {
case "武侠仙侠": {
catNum = 2;
break;
}
case "都市言情": {
catNum = 3;
break;
}
case "历史军事": {
catNum = 4;
break;
}
case "科幻灵异": {
catNum = 5;
break;
}
case "网游竞技": {
catNum = 6;
break;
}
case "女生频道": {
catNum = 7;
break;
}
default: {
catNum = 1;
break;
}
}
Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>"); Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
Matcher updateTimeMatch = updateTimePatten.matcher(body); Matcher updateTimeMatch = updateTimePatten.matcher(body);
if (updateTimeMatch.find()) { if (updateTimeMatch.find()) {
@ -417,8 +387,8 @@ public class CrawlBooksSchedule {
int indexNum = 0; int indexNum = 0;
//查询该书籍已存在目录号 //查询该书籍已存在目录号
List<Integer> hasIndexNum = bookService.queryIndexCountByBookNameAndAuthor(bookName, author); List<Integer> hasIndexNum = bookService.queryIndexNumByBookNameAndAuthor(bookName, author);
//更新和插入分别开插入只在凌晨做一次 //只更新已存在的书籍
if (hasIndexNum.size() > 0) { if (hasIndexNum.size() > 0) {
while (isFindIndex) { while (isFindIndex) {
if (!hasIndexNum.contains(indexNum)) { if (!hasIndexNum.contains(indexNum)) {
@ -495,6 +465,41 @@ public class CrawlBooksSchedule {
} }
private int getCatNum(String catName) {
int catNum;
switch (catName) {
case "武侠仙侠": {
catNum = 2;
break;
}
case "都市言情": {
catNum = 3;
break;
}
case "历史军事": {
catNum = 4;
break;
}
case "科幻灵异": {
catNum = 5;
break;
}
case "网游竞技": {
catNum = 6;
break;
}
case "女生频道": {
catNum = 7;
break;
}
default: {
catNum = 1;
break;
}
}
return catNum;
}
private String getByRestTemplate(String url) { private String getByRestTemplate(String url) {
try { try {
ResponseEntity<String> forEntity = utf8RestTemplate.getForEntity(url, String.class); ResponseEntity<String> forEntity = utf8RestTemplate.getForEntity(url, String.class);

View File

@ -51,4 +51,38 @@ public class Constants {
public static final String CRAWL_CARTOON_STATIC_URL_PREFIX = "https://static.dmzj.com/"; public static final String CRAWL_CARTOON_STATIC_URL_PREFIX = "https://static.dmzj.com/";
/**
* 最大的小说分类ID
* */
public static final Integer MAX_NOVEL_CAT = 7;
/**
* 小说是否正在下载的key
* */
public static final String NOVEL_IS_DOWNLOADING_KEY = "isDownloading";
/**
* 轻小说分类ID
* */
public static final int SOFT_NOVEL_CAT = 8;
/**
* 漫画分类ID
* */
public static final int MH_NOVEL_CAT = 9;
/**
* 小说排行字段名
* */
public static final String NOVEL_TOP_FIELD = "score";
/**
* 完本小说标识名
* */
public static final String NOVEL_END_TAG = "完成";
/**
* 多本书籍ID分隔符
* */
public static final String BOOK_ID_SEPARATOR = "-";
} }

View File

@ -3,9 +3,9 @@ server:
spring: spring:
datasource: datasource:
url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai url: jdbc:mysql://47.106.243.172:3306/books?useUnicode=true&characterEncoding=utf-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: books username: books
password: books password: books!8888
# url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai # url: jdbc:mysql://127.0.0.1:3306/books?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
# username: root # username: root
# password: test123456 # password: test123456

View File

@ -313,7 +313,7 @@
" </li>"); " </li>");
}else{ }else{
innerHtml += ("<li class=\"tag\">\n" + innerHtml += ("<li class=\"tag\">\n" +
" <a href=\"/book/searchMhBook.html?softTag=" + encodeURI(tag) + "\" class=\"highlight\"><span class=\"layui-icon\">&#xe66e;</span><span class=\"text\">" + tag + "</span></a>\n" + " <a href=\"/book/searchSoftBook.html?catId=9&softTag=" + encodeURI(tag) + "\" class=\"highlight\"><span class=\"layui-icon\">&#xe66e;</span><span class=\"text\">" + tag + "</span></a>\n" +
" </li>"); " </li>");
} }
} }

View File

@ -89,21 +89,21 @@
<input type="hidden" id="softCat" th:value="${softCat}"/> <input type="hidden" id="softCat" th:value="${softCat}"/>
<ul class="layui-nav" lay-filter="" style="padding:0 20px;text-align: center" > <ul class="layui-nav" lay-filter="" style="padding:0 20px;text-align: center" >
<li id="menunew" class="layui-nav-item"><a href="/book/searchMhBook.html">最新</a></li> <li id="menunew" class="layui-nav-item"><a href="/book/searchSoftBook.html?catId=9">最新</a></li>
<li id="menu21" class="layui-nav-item"><a href="/book/searchMhBook.html?softCat=3262">少年漫</a></li> <li id="menu21" class="layui-nav-item"><a href="/book/searchSoftBook.html?catId=9&softCat=3262">少年漫</a></li>
<li id="menu22" class="layui-nav-item"><a href="/book/searchMhBook.html?softCat=3263">少女漫</a></li> <li id="menu22" class="layui-nav-item"><a href="/book/searchSoftBook.html?catId=9&softCat=3263">少女漫</a></li>
<li id="menucomplete" class="layui-nav-item"><a >完本</a> <li id="menucomplete" class="layui-nav-item"><a >完本</a>
<dl class="layui-nav-child"> <!-- 二级菜单 --> <dl class="layui-nav-child"> <!-- 二级菜单 -->
<dd><a href="/book/searchMhBook.html?bookStatus=已完成">全部</a></dd> <dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成">全部</a></dd>
<dd><a href="/book/searchMhBook.html?bookStatus=已完成&softCat=3262">少年漫</a></dd> <dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成&softCat=3262">少年漫</a></dd>
<dd><a href="/book/searchMhBook.html?bookStatus=已完成&softCat=3263">少女漫</a></dd> <dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成&softCat=3263">少女漫</a></dd>
</dl> </dl>
</li> </li>
<li id="menuhot" class="layui-nav-item"><a >排行</a> <li id="menuhot" class="layui-nav-item"><a >排行</a>
<dl class="layui-nav-child"> <!-- 二级菜单 --> <dl class="layui-nav-child"> <!-- 二级菜单 -->
<dd><a href="/book/searchMhBook.html?sortBy=score">全部</a></dd> <dd><a href="/book/searchSoftBook.html?catId=9&sortBy=score">全部</a></dd>
<dd><a href="/book/searchMhBook.html?sortBy=score&softCat=3262">少年漫</a></dd> <dd><a href="/book/searchSoftBook.html?catId=9&sortBy=score&softCat=3262">少年漫</a></dd>
<dd><a href="/book/searchMhBook.html?bookStatus=已完成&softCat=3263">少女漫</a></dd> <dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成&softCat=3263">少女漫</a></dd>
</dl> </dl>
</li> </li>
@ -139,7 +139,7 @@
th:text="${book.bookName}"></div> th:text="${book.bookName}"></div>
</a> </a>
<div style=";color: #4c6978;float: right;"><i style="color: red" th:text="${book.score} + '分'"></i></div> <div style=";color: #4c6978;float: right;"><i style="color: red" th:text="${book.score} + '分'"></i></div>
<a th:href="'/book/searchMhBook.html?keyword='+ ${book.author}"> <a th:href="'/book/searchSoftBook.html?catId=9&keyword='+ ${book.author}">
<div style=";color: #4c6978;" class="line-limit-length" th:text="'作者'+ ${book.author}"></div> <div style=";color: #4c6978;" class="line-limit-length" th:text="'作者'+ ${book.author}"></div>
</a> </a>
<div style="margin-top: 5px;color: #4c6978;" th:text="'类别:'+ ${book.cateName}"></div> <div style="margin-top: 5px;color: #4c6978;" th:text="'类别:'+ ${book.cateName}"></div>
@ -201,7 +201,7 @@
}); });
function searchByAllCondition(curr,limit,newKeyword){ function searchByAllCondition(curr,limit,newKeyword){
var toUrl = "/book/searchMhBook.html?curr=" + curr + "&limit=" + limit; var toUrl = "/book/searchSoftBook.html?catId=9&curr=" + curr + "&limit=" + limit;
var ids = $("#ids").val(); var ids = $("#ids").val();
if(ids){ if(ids){
toUrl += ("&historyBookIds=" + ids); toUrl += ("&historyBookIds=" + ids);

View File

@ -1,6 +1,6 @@
<div th:fragment="footer" style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan"> <div th:fragment="footer" style="height: 60px;line-height: 60px;text-align: center" class="layui-footer footer footer-demo layui-bg-cyan">
<a href="/book/searchSoftBook.html" style="font-size: 14px;color: #92B8B1;">轻小说</a> <a href="/book/searchSoftBook.html" style="font-size: 14px;color: #92B8B1;">轻小说</a>
<a href="/book/searchMhBook.html" style="font-size: 14px;color: #92B8B1;margin-left: 8px">漫画</a> <a href="/book/searchSoftBook.html?catId=9" style="font-size: 14px;color: #92B8B1;margin-left: 8px">漫画</a>
<a href="javascript:readHistory()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">阅读记录</a> <a href="javascript:readHistory()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">阅读记录</a>
<a href="javascript:toMyCollect()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">书架</a> <a href="javascript:toMyCollect()" style="font-size: 14px;color: #92B8B1;margin-left: 8px">书架</a>
<a href="/HotBook.apk" style="font-size: 14px;color: #92B8B1;margin-left: 8px">客户端</a> <a href="/HotBook.apk" style="font-size: 14px;color: #92B8B1;margin-left: 8px">客户端</a>