mirror of
https://github.com/201206030/novel.git
synced 2025-04-27 07:30:50 +00:00
修复笔趣塔分类更新错误的问题
This commit is contained in:
parent
66753cb0d4
commit
3dcabd3cf3
@ -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;
|
||||
}
|
@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import tk.mybatis.orderbyhelper.OrderByHelper;
|
||||
import xyz.zinglizingli.books.constant.CacheKeyConstans;
|
||||
import xyz.zinglizingli.books.enums.PicSaveType;
|
||||
import xyz.zinglizingli.books.mapper.*;
|
||||
import xyz.zinglizingli.books.po.*;
|
||||
import xyz.zinglizingli.books.util.UUIDUtils;
|
||||
@ -27,6 +28,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author XXY
|
||||
@ -49,7 +51,7 @@ public class BookService {
|
||||
private final CommonCacheUtil cacheUtil;
|
||||
|
||||
@Value("${pic.save.type}")
|
||||
private Byte picSaveType;
|
||||
private Integer picSaveType;
|
||||
|
||||
@Value("${pic.save.path}")
|
||||
private String picSavePath;
|
||||
@ -71,45 +73,15 @@ public class BookService {
|
||||
if (books.size() > 0) {
|
||||
//更新
|
||||
bookId = books.get(0).getId();
|
||||
book.setId(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);
|
||||
updateBook(book, bookId);
|
||||
isUpdate = true;
|
||||
|
||||
} else {
|
||||
//插入
|
||||
if (book.getVisitCount() == null) {
|
||||
Long visitCount = generateVisiteCount(book.getScore());
|
||||
Long visitCount = generateVisitCount(book.getScore());
|
||||
book.setVisitCount(visitCount);
|
||||
}
|
||||
//插入
|
||||
int rows = bookMapper.insertSelective(book);
|
||||
if (rows > 0) {
|
||||
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);
|
||||
return Long.parseLong(baseNum + new Random().nextInt(1000) + "");
|
||||
}
|
||||
@ -340,10 +350,9 @@ public class BookService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询该书籍目录数量
|
||||
* 查询该书籍已存在目录号
|
||||
*/
|
||||
public List<Integer> queryIndexCountByBookNameAndAuthor(String bookName, String author) {
|
||||
List<Integer> result = new ArrayList<>();
|
||||
public List<Integer> queryIndexNumByBookNameAndAuthor(String bookName, String author) {
|
||||
BookExample example = new BookExample();
|
||||
example.createCriteria().andBookNameEqualTo(bookName).andAuthorEqualTo(author);
|
||||
List<Book> books = bookMapper.selectByExample(example);
|
||||
@ -353,15 +362,13 @@ public class BookService {
|
||||
BookIndexExample bookIndexExample = new BookIndexExample();
|
||||
bookIndexExample.createCriteria().andBookIdEqualTo(bookId);
|
||||
List<BookIndex> bookIndices = bookIndexMapper.selectByExample(bookIndexExample);
|
||||
if (bookIndices != null && bookIndices.size() > 0) {
|
||||
for (BookIndex bookIndex : bookIndices) {
|
||||
result.add(bookIndex.getIndexNum());
|
||||
}
|
||||
if(bookIndices.size()>0) {
|
||||
return bookIndices.stream().map(BookIndex::getIndexNum).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
return new ArrayList<>(0);
|
||||
|
||||
}
|
||||
|
||||
@ -494,15 +501,6 @@ public class BookService {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询完本书籍
|
||||
* */
|
||||
public List<String> queryEndBookIdList() {
|
||||
return bookMapper.queryEndBookIdList();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -20,8 +20,8 @@ import xyz.zinglizingli.books.service.BookService;
|
||||
import xyz.zinglizingli.books.service.UserService;
|
||||
import xyz.zinglizingli.books.vo.BookVO;
|
||||
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.HttpSession;
|
||||
import java.io.OutputStream;
|
||||
@ -31,6 +31,7 @@ import java.util.*;
|
||||
|
||||
/**
|
||||
* 小说Controller
|
||||
*
|
||||
* @author 11797
|
||||
*/
|
||||
@Controller
|
||||
@ -46,66 +47,63 @@ public class BookController {
|
||||
private final CommonCacheUtil commonCacheUtil;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 精品小说搜索页
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("search")
|
||||
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 = "historyBookIds", required = false) String ids,
|
||||
@RequestParam(value = "bookStatus", required = false) String bookStatus,
|
||||
@RequestParam(value = "token", required = false) String token,
|
||||
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy, @RequestParam(value = "sort", defaultValue = "DESC") String sort,
|
||||
HttpServletRequest req, HttpServletResponse resp, ModelMap modelMap) {
|
||||
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy,
|
||||
@RequestParam(value = "sort", defaultValue = "DESC") String sort, ModelMap modelMap) {
|
||||
|
||||
String userId = null;
|
||||
String titleType = "最近更新";
|
||||
if (catId != null) {
|
||||
titleType = bookService.getCatNameById(catId) + "分类频道";
|
||||
;
|
||||
} else if ("score".equals(sortBy)) {
|
||||
} else if (Constants.NOVEL_TOP_FIELD.equals(sortBy)) {
|
||||
titleType = "小说排行";
|
||||
} else if (ids != null) {
|
||||
titleType = "阅读记录";
|
||||
} else if (token != null) {
|
||||
userId = commonCacheUtil.get(token);
|
||||
titleType = "我的书架";
|
||||
} else if (bookStatus != null && bookStatus.contains("完成")) {
|
||||
} else if (bookStatus != null && bookStatus.contains(Constants.NOVEL_END_TAG)) {
|
||||
titleType = "完本小说";
|
||||
} else if (keyword != null) {
|
||||
titleType = "搜索";
|
||||
}
|
||||
modelMap.put("titleType", titleType);
|
||||
List<Book> books;
|
||||
List<BookVO> bookVOList;
|
||||
List<BookVO> bookVoList;
|
||||
if (StringUtils.isEmpty(ids) || !StringUtils.isEmpty(keyword)) {
|
||||
books = bookService.search(page, pageSize, userId, ids, keyword, bookStatus, catId, null, null, sortBy, sort);
|
||||
bookVOList = new ArrayList<>();
|
||||
bookVoList = new ArrayList<>();
|
||||
for (Book book : books) {
|
||||
BookVO bookvo = new BookVO();
|
||||
BeanUtils.copyProperties(book, bookvo);
|
||||
bookvo.setCateName(bookService.getCatNameById(bookvo.getCatid()));
|
||||
bookVOList.add(bookvo);
|
||||
bookVoList.add(bookvo);
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!ids.contains("-")) {
|
||||
books = bookService.search(page, 50, userId, ids, keyword, null, catId, null, null, sortBy, sort);
|
||||
if (!ids.contains(Constants.BOOK_ID_SEPARATOR)) {
|
||||
books = bookService.search(page, 50, null, ids, keyword, null, catId, null, null, sortBy, sort);
|
||||
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) {
|
||||
int index = idsArr.indexOf(book.getId() + "");
|
||||
BookVO bookvo = new BookVO();
|
||||
BeanUtils.copyProperties(book, bookvo);
|
||||
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 {
|
||||
books = new ArrayList<>();
|
||||
bookVOList = new ArrayList<>();
|
||||
bookVoList = new ArrayList<>();
|
||||
}
|
||||
|
||||
}
|
||||
@ -114,7 +112,7 @@ public class BookController {
|
||||
modelMap.put("limit", bookPageInfo.getPageSize());
|
||||
modelMap.put("curr", bookPageInfo.getPageNum());
|
||||
modelMap.put("total", bookPageInfo.getTotal());
|
||||
modelMap.put("books", bookVOList);
|
||||
modelMap.put("books", bookVoList);
|
||||
modelMap.put("ids", ids);
|
||||
modelMap.put("token", token);
|
||||
modelMap.put("bookStatus", bookStatus);
|
||||
@ -127,26 +125,31 @@ public class BookController {
|
||||
|
||||
|
||||
/**
|
||||
* 轻小说搜索页
|
||||
* */
|
||||
* 轻小说或漫画搜索页
|
||||
*/
|
||||
@RequestMapping("searchSoftBook.html")
|
||||
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 = "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) {
|
||||
@RequestParam(value = "sortBy", defaultValue = "update_time") String sortBy,
|
||||
@RequestParam(value = "sort", defaultValue = "DESC") String sort, 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<>();
|
||||
List<Book> books = bookService.search(page, pageSize, null, 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.getSoftCatNameById(bookvo.getSoftCat()));
|
||||
bookVOList.add(bookvo);
|
||||
if(catId == Constants.SOFT_NOVEL_CAT) {
|
||||
//轻小说
|
||||
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("curr", bookPageInfo.getPageNum());
|
||||
modelMap.put("total", bookPageInfo.getTotal());
|
||||
modelMap.put("books", bookVOList);
|
||||
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/soft_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);
|
||||
if(catId == Constants.SOFT_NOVEL_CAT){
|
||||
//轻小说
|
||||
return "books/soft_book_search";
|
||||
}else if(catId == Constants.MH_NOVEL_CAT){
|
||||
//漫画
|
||||
return "books/mh_book_search";
|
||||
}
|
||||
|
||||
|
||||
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";
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 书籍详情页
|
||||
* */
|
||||
*/
|
||||
@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);
|
||||
if(org.apache.commons.lang3.StringUtils.isNotBlank(userId)){
|
||||
Integer indexNumber = userService.queryBookIndexNumber(userId,bookId);
|
||||
if(indexNumber!=null){
|
||||
return "redirect:/book/"+bookId+"/"+indexNumber+".html";
|
||||
if (org.apache.commons.lang3.StringUtils.isNotBlank(userId)) {
|
||||
Integer indexNumber = userService.queryBookIndexNumber(userId, bookId);
|
||||
if (indexNumber != null) {
|
||||
return "redirect:/book/" + bookId + "/" + indexNumber + ".html";
|
||||
}
|
||||
|
||||
}
|
||||
@ -246,7 +219,7 @@ public class BookController {
|
||||
|
||||
/**
|
||||
* 书籍目录页
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("{bookId}/index.html")
|
||||
public String bookIndex(@PathVariable("bookId") Long bookId, ModelMap modelMap) {
|
||||
List<BookIndex> indexList = bookService.queryAllIndexList(bookId);
|
||||
@ -260,7 +233,7 @@ public class BookController {
|
||||
|
||||
/**
|
||||
* 书籍内容页
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("{bookId}/{indexNum}.html")
|
||||
public String bookContent(@PathVariable("bookId") Long bookId, @PathVariable("indexNum") Integer indexNum, ModelMap modelMap) {
|
||||
BookContent bookContent = bookService.queryBookContent(bookId, indexNum);
|
||||
@ -278,11 +251,11 @@ public class BookController {
|
||||
List<Integer> preAndNextIndexNum = bookService.queryPreAndNextIndexNum(bookId, indexNum);
|
||||
modelMap.put("nextIndexNum", preAndNextIndexNum.get(0));
|
||||
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("indexName", indexName);
|
||||
Book basicBook = bookService.queryBaseInfo(bookId);
|
||||
if(basicBook.getCatid() < 8) {
|
||||
if (basicBook.getCatid() <= Constants.MAX_NOVEL_CAT) {
|
||||
bookContent.setContent(StringEscapeUtils.unescapeHtml4(bookContent.getContent()));
|
||||
}
|
||||
String bookName = basicBook.getBookName();
|
||||
@ -295,24 +268,24 @@ public class BookController {
|
||||
|
||||
/**
|
||||
* 增加访问次数
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("addVisit")
|
||||
@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);
|
||||
|
||||
bookService.addVisitCount(bookId,userId,indexNum);
|
||||
bookService.addVisitCount(bookId, userId, indexNum);
|
||||
|
||||
return "ok";
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送弹幕
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("sendBullet")
|
||||
@ResponseBody
|
||||
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);
|
||||
result.put("code", 1);
|
||||
result.put("desc", "ok");
|
||||
@ -321,12 +294,12 @@ public class BookController {
|
||||
|
||||
/**
|
||||
* 查询是否正在下载
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("queryIsDownloading")
|
||||
@ResponseBody
|
||||
public Map<String, Object> queryIsDownloading(HttpSession session) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (session.getAttribute("isDownloading") != null) {
|
||||
Map<String, Object> result = new HashMap<>(1);
|
||||
if (session.getAttribute(Constants.NOVEL_IS_DOWNLOADING_KEY) != null) {
|
||||
result.put("code", 1);
|
||||
} else {
|
||||
result.put("code", 0);
|
||||
@ -337,7 +310,7 @@ public class BookController {
|
||||
|
||||
/**
|
||||
* 查询弹幕
|
||||
* */
|
||||
*/
|
||||
@RequestMapping("queryBullet")
|
||||
@ResponseBody
|
||||
public List<ScreenBullet> queryBullet(@RequestParam("contentId") Long contentId) {
|
||||
@ -352,7 +325,7 @@ public class BookController {
|
||||
@RequestMapping(value = "/download")
|
||||
public void download(@RequestParam("bookId") Long bookId, @RequestParam("bookName") String bookName, HttpServletResponse resp, HttpSession session) {
|
||||
try {
|
||||
session.setAttribute("isDownloading", 1);
|
||||
session.setAttribute(Constants.NOVEL_IS_DOWNLOADING_KEY, 1);
|
||||
int count = bookService.countIndex(bookId);
|
||||
|
||||
|
||||
@ -365,19 +338,19 @@ public class BookController {
|
||||
if (count > 0) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
String index = bookService.queryIndexNameByBookIdAndIndexNum(bookId, i);
|
||||
if(index != null) {
|
||||
if (index != null) {
|
||||
String content = bookService.queryContentList(bookId, i);
|
||||
out.write(index.getBytes(StandardCharsets.UTF_8));
|
||||
out.write("\n".getBytes(StandardCharsets.UTF_8));
|
||||
content = content.replaceAll("<br\\s*/*>", "\r\n");
|
||||
content = content.replaceAll(" ", " ");
|
||||
content = content.replaceAll("<a[^>]*>", "");
|
||||
content = content.replaceAll("</a>", "");
|
||||
content = content.replaceAll("<div[^>]*>", "");
|
||||
content = content.replaceAll("</div>", "");
|
||||
content = content.replaceAll("<p[^>]*>[^<]*<a[^>]*>[^<]*</a>\\s*</p>", "");
|
||||
content = content.replaceAll("<p[^>]*>", "");
|
||||
content = content.replaceAll("</p>", "\r\n");
|
||||
content = content.replaceAll("<br\\s*/*>", "\r\n")
|
||||
.replaceAll(" ", " ")
|
||||
.replaceAll("<a[^>]*>", "")
|
||||
.replaceAll("</a>", "")
|
||||
.replaceAll("<div[^>]*>", "")
|
||||
.replaceAll("</div>", "")
|
||||
.replaceAll("<p[^>]*>[^<]*<a[^>]*>[^<]*</a>\\s*</p>", "")
|
||||
.replaceAll("<p[^>]*>", "")
|
||||
.replaceAll("</p>", "\r\n");
|
||||
out.write(content.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) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
session.removeAttribute("isDownloading");
|
||||
session.removeAttribute(Constants.NOVEL_IS_DOWNLOADING_KEY);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -7,44 +7,30 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import xyz.zinglizingli.common.cache.CommonCacheUtil;
|
||||
|
||||
/**
|
||||
* @author 11797
|
||||
*/
|
||||
@Service
|
||||
public class EHCacheUtil implements CommonCacheUtil {
|
||||
public class EhCacheUtil implements CommonCacheUtil {
|
||||
|
||||
@Autowired
|
||||
private CacheManager cacheManager ;
|
||||
|
||||
private static final String CACHE_NAME = "utilCache";
|
||||
private static final String CACHE_NAME = "util_cache";
|
||||
|
||||
|
||||
/**
|
||||
* 获得一个Cache,没有则创建一个。
|
||||
* @param cacheName
|
||||
* @return
|
||||
*/
|
||||
private Cache getCache(){
|
||||
|
||||
/*Cache cache = cacheManager.getCache(cacheName);
|
||||
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");
|
||||
Cache cache = cacheManager.getCache(CACHE_NAME);
|
||||
return cache;
|
||||
}
|
||||
|
||||
|
||||
public CacheManager getCacheManager() {
|
||||
return cacheManager;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String get(String key) {
|
||||
Element element = getCache().get(key);
|
||||
@ -55,7 +41,8 @@ public class EHCacheUtil implements CommonCacheUtil {
|
||||
public void set(String key, String value) {
|
||||
Element element = new Element(key, value);
|
||||
Cache cache = getCache();
|
||||
cache.getCacheConfiguration().setEternal(true);//不过期
|
||||
//不过期
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
@ -106,13 +93,13 @@ public class EHCacheUtil implements CommonCacheUtil {
|
||||
|
||||
/**
|
||||
* 设置Object类型的缓存
|
||||
* @param <T>
|
||||
*/
|
||||
@Override
|
||||
public void setObject(String key, Object value) {
|
||||
Element element = new Element(key, value);
|
||||
Cache cache = getCache();
|
||||
cache.getCacheConfiguration().setEternal(true);//不过期
|
||||
//不过期
|
||||
cache.getCacheConfiguration().setEternal(true);
|
||||
cache.put(element);
|
||||
|
||||
}
|
||||
@ -131,6 +118,9 @@ public class EHCacheUtil implements CommonCacheUtil {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新过期时间
|
||||
* */
|
||||
@Override
|
||||
public void refresh(String key) {
|
||||
Element element = getCache().get(key);
|
@ -46,10 +46,6 @@ public class CrawlBooksSchedule {
|
||||
@Value("${crawl.website.type}")
|
||||
private Byte websiteType;
|
||||
|
||||
|
||||
@Value("${pic.save.type}")
|
||||
private Byte picSaveType;
|
||||
|
||||
@Value("${pic.save.path}")
|
||||
private String picSavePath;
|
||||
|
||||
@ -96,7 +92,7 @@ public class CrawlBooksSchedule {
|
||||
if (isFind) {
|
||||
//解析第一页书籍的数据
|
||||
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);
|
||||
|
||||
boolean isFind = bookMatcher.find();
|
||||
@ -142,108 +138,112 @@ public class CrawlBooksSchedule {
|
||||
if (statusMatch.find()) {
|
||||
String status = statusMatch.group(1);
|
||||
|
||||
Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
|
||||
Matcher updateTimeMatch = updateTimePatten.matcher(body);
|
||||
if (updateTimeMatch.find()) {
|
||||
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);
|
||||
Pattern catPatten = compile("类别:([^/]+)</li>");
|
||||
Matcher catMatch = catPatten.matcher(body);
|
||||
if (catMatch.find()) {
|
||||
String catName = catMatch.group(1);
|
||||
int catNum = getCatNum(catName);
|
||||
|
||||
|
||||
Pattern descPatten = compile("class=\"review\">([^<]+)</p>");
|
||||
Matcher descMatch = descPatten.matcher(body);
|
||||
if (descMatch.find()) {
|
||||
String desc = descMatch.group(1);
|
||||
Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
|
||||
Matcher updateTimeMatch = updateTimePatten.matcher(body);
|
||||
if (updateTimeMatch.find()) {
|
||||
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();
|
||||
book.setAuthor(author);
|
||||
book.setCatid(catNum);
|
||||
book.setBookDesc(desc);
|
||||
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);
|
||||
Pattern descPatten = compile("class=\"review\">([^<]+)</p>");
|
||||
Matcher descMatch = descPatten.matcher(body);
|
||||
if (descMatch.find()) {
|
||||
String desc = descMatch.group(1);
|
||||
|
||||
|
||||
//查询章节内容
|
||||
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);
|
||||
Book book = new Book();
|
||||
book.setAuthor(author);
|
||||
book.setCatid(catNum);
|
||||
book.setBookDesc(desc);
|
||||
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.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);
|
||||
if (catMatch.find()) {
|
||||
String catName = catMatch.group(1);
|
||||
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;
|
||||
}
|
||||
}
|
||||
int catNum = getCatNum(catName);
|
||||
Pattern updateTimePatten = compile("更新:(\\d+-\\d+-\\d+\\s\\d+:\\d+:\\d+)</a>");
|
||||
Matcher updateTimeMatch = updateTimePatten.matcher(body);
|
||||
if (updateTimeMatch.find()) {
|
||||
@ -417,8 +387,8 @@ public class CrawlBooksSchedule {
|
||||
int indexNum = 0;
|
||||
|
||||
//查询该书籍已存在目录号
|
||||
List<Integer> hasIndexNum = bookService.queryIndexCountByBookNameAndAuthor(bookName, author);
|
||||
//更新和插入分别开,插入只在凌晨做一次
|
||||
List<Integer> hasIndexNum = bookService.queryIndexNumByBookNameAndAuthor(bookName, author);
|
||||
//只更新已存在的书籍
|
||||
if (hasIndexNum.size() > 0) {
|
||||
while (isFindIndex) {
|
||||
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) {
|
||||
try {
|
||||
ResponseEntity<String> forEntity = utf8RestTemplate.getForEntity(url, String.class);
|
||||
|
@ -51,4 +51,38 @@ public class Constants {
|
||||
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 = "-";
|
||||
}
|
||||
|
@ -3,9 +3,9 @@ server:
|
||||
|
||||
spring:
|
||||
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
|
||||
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
|
||||
# username: root
|
||||
# password: test123456
|
||||
|
@ -313,7 +313,7 @@
|
||||
" </li>");
|
||||
}else{
|
||||
innerHtml += ("<li class=\"tag\">\n" +
|
||||
" <a href=\"/book/searchMhBook.html?softTag=" + encodeURI(tag) + "\" class=\"highlight\"><span class=\"layui-icon\"></span><span class=\"text\">" + tag + "</span></a>\n" +
|
||||
" <a href=\"/book/searchSoftBook.html?catId=9&softTag=" + encodeURI(tag) + "\" class=\"highlight\"><span class=\"layui-icon\"></span><span class=\"text\">" + tag + "</span></a>\n" +
|
||||
" </li>");
|
||||
}
|
||||
}
|
||||
|
@ -89,21 +89,21 @@
|
||||
<input type="hidden" id="softCat" th:value="${softCat}"/>
|
||||
|
||||
<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="menu21" class="layui-nav-item"><a href="/book/searchMhBook.html?softCat=3262">少年漫</a></li>
|
||||
<li id="menu22" class="layui-nav-item"><a href="/book/searchMhBook.html?softCat=3263">少女漫</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/searchSoftBook.html?catId=9&softCat=3262">少年漫</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>
|
||||
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
||||
<dd><a href="/book/searchMhBook.html?bookStatus=已完成">全部</a></dd>
|
||||
<dd><a href="/book/searchMhBook.html?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=已完成">全部</a></dd>
|
||||
<dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成&softCat=3262">少年漫</a></dd>
|
||||
<dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成&softCat=3263">少女漫</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
<li id="menuhot" class="layui-nav-item"><a >排行</a>
|
||||
<dl class="layui-nav-child"> <!-- 二级菜单 -->
|
||||
<dd><a href="/book/searchMhBook.html?sortBy=score">全部</a></dd>
|
||||
<dd><a href="/book/searchMhBook.html?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&sortBy=score">全部</a></dd>
|
||||
<dd><a href="/book/searchSoftBook.html?catId=9&sortBy=score&softCat=3262">少年漫</a></dd>
|
||||
<dd><a href="/book/searchSoftBook.html?catId=9&bookStatus=已完成&softCat=3263">少女漫</a></dd>
|
||||
</dl>
|
||||
</li>
|
||||
|
||||
@ -139,7 +139,7 @@
|
||||
th:text="${book.bookName}"></div>
|
||||
</a>
|
||||
<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>
|
||||
</a>
|
||||
<div style="margin-top: 5px;color: #4c6978;" th:text="'类别:'+ ${book.cateName}"></div>
|
||||
@ -201,7 +201,7 @@
|
||||
});
|
||||
|
||||
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();
|
||||
if(ids){
|
||||
toUrl += ("&historyBookIds=" + ids);
|
||||
|
@ -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">
|
||||
<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: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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user