mirror of
https://github.com/201206030/novel-plus.git
synced 2025-07-19 07:36:39 +00:00
Compare commits
3 Commits
v5.2.2
...
develop_xx
Author | SHA1 | Date | |
---|---|---|---|
8c7b891af2 | |||
bb1a87e337 | |||
1cd8a49fd4 |
@ -3175,3 +3175,42 @@ CREATE TABLE `book_comment_reply`
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB
|
||||
DEFAULT CHARSET = utf8mb4 COMMENT ='小说评论回复表';
|
||||
|
||||
|
||||
INSERT INTO crawl_source (source_name, crawl_rule, source_status, create_time
|
||||
, update_time)
|
||||
VALUES ('飘天文学网(海外专用)', '{
|
||||
"bookListUrl": "https://www.piaotia.com/booksort{catId}/{page}.html",
|
||||
"catIdRule": {
|
||||
"catId1": "1/0",
|
||||
"catId2": "2/0",
|
||||
"catId3": "3/0",
|
||||
"catId4": "4/0",
|
||||
"catId5": "6/0",
|
||||
"catId6": "5/0"
|
||||
},
|
||||
"bookIdPatten": "href=\\"https://www.piaotia.com/bookinfo/(\\\\d+/\\\\d+).html\\"",
|
||||
"pagePatten": "<em\\\\s+id=\\"pagestats\\">(\\\\d+)/\\\\d+</em>",
|
||||
"totalPagePatten": "<em\\\\s+id=\\"pagestats\\">\\\\d+/(\\\\d+)</em>",
|
||||
"bookDetailUrl": "https://www.piaotia.com/bookinfo/{bookId}.html",
|
||||
"bookNamePatten": "<h1>([^/]+)</h1>",
|
||||
"authorNamePatten": "<td\\\\s+width=\\"\\\\d+%\\">作 者:([^/]+)<",
|
||||
"picUrlPatten": "<img\\\\s+src=\\"(https://www.piaotia.com/files/article/image/[^\\"]+)\\"",
|
||||
"statusPatten": "<td>文章状态:([^/]+)</td>",
|
||||
"bookStatusRule": {
|
||||
"连载中": 0,
|
||||
"已完成": 1
|
||||
},
|
||||
"descStart": " <span class=\\"hottext\\">内容简介:</span><br />",
|
||||
"descEnd": "</td>",
|
||||
"filterDesc": "",
|
||||
"bookIndexUrl": "https://www.piaotia.com/html/{bookId}/index.html",
|
||||
"indexIdPatten": "<li><a href=\\"(\\\\d+).html\\">[^/]+</a></li>",
|
||||
"indexNamePatten": "<li><a href=\\"\\\\d+.html\\">([^/]+)</a></li>",
|
||||
"bookContentUrl": "https://www.piaotia.com/html/{bookId}/{indexId}.html",
|
||||
"contentStart": "<br>",
|
||||
"contentEnd": "</div>",
|
||||
"filterContent": "",
|
||||
"charset": "gbk"
|
||||
}', 0, '2025-07-13 18:57:39'
|
||||
, '2025-07-13 18:57:39');
|
@ -25,10 +25,10 @@ import java.util.Map;
|
||||
public class SortOrderValidationAspect {
|
||||
|
||||
/**
|
||||
* 拦截所有的mapper方法
|
||||
* 拦截mapper的所有list方法
|
||||
*/
|
||||
@SneakyThrows
|
||||
@Around("execution(* com.java2nb.*.dao.*Dao.*(..))")
|
||||
@Around("execution(* com.java2nb.*.dao.*Dao.list*(..))")
|
||||
public Object validateSortAndOrder(ProceedingJoinPoint joinPoint) {
|
||||
Object[] args = joinPoint.getArgs();
|
||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||
|
@ -14,8 +14,7 @@ import java.util.Set;
|
||||
public class SortWhitelistUtil {
|
||||
|
||||
private final Set<String> allowedColumns = new HashSet<>(
|
||||
Arrays.asList("id", "name", "create_time", "update_time", "order_num", "last_index_update_time", "word_count",
|
||||
"visit_count"));
|
||||
Arrays.asList("id", "name", "order_num"));
|
||||
private final Set<String> allowedOrders = new HashSet<>(Arrays.asList("asc", "desc"));
|
||||
|
||||
public String sanitizeColumn(String input) {
|
||||
|
@ -11,7 +11,6 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author xiongxy
|
||||
* @email 1179705413@qq.com
|
||||
* @date 2019-10-03 09:45:11
|
||||
@ -21,9 +20,9 @@ public interface SysUserDao {
|
||||
|
||||
UserDO get(Long userId);
|
||||
|
||||
List<UserDO> list(@ValidateSortOrder Map<String,Object> map);
|
||||
List<UserDO> list(@ValidateSortOrder Map<String, Object> map);
|
||||
|
||||
int count(Map<String,Object> map);
|
||||
int count(Map<String, Object> map);
|
||||
|
||||
int save(UserDO user);
|
||||
|
||||
@ -35,7 +34,7 @@ public interface SysUserDao {
|
||||
|
||||
Long[] listAllDept();
|
||||
|
||||
List<UserDO> listByPerm(Map<String, Object> map);
|
||||
List<UserDO> listByPerm(@ValidateSortOrder Map<String, Object> map);
|
||||
|
||||
int countByPerm(Map<String,Object> map);
|
||||
int countByPerm(Map<String, Object> map);
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ import java.util.*;
|
||||
* @date 2025/7/17
|
||||
*/
|
||||
@Aspect
|
||||
@Component
|
||||
//@Component
|
||||
@RequiredArgsConstructor
|
||||
public class SortOrderValidationAspect {
|
||||
|
||||
|
@ -59,7 +59,7 @@
|
||||
<!-- AI -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.ai</groupId>
|
||||
<artifactId>spring-ai-openai-spring-boot-starter</artifactId>
|
||||
<artifactId>spring-ai-starter-model-openai</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
@ -15,6 +15,7 @@ import io.github.xxyopen.model.resp.RestResult;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -82,7 +83,7 @@ public class BookController extends BaseController {
|
||||
* 分页搜索
|
||||
*/
|
||||
@GetMapping("searchByPage")
|
||||
public RestResult<?> searchByPage(BookSpVO bookSP, @RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
public RestResult<?> searchByPage(@Validated BookSpVO bookSP, @RequestParam(value = "curr", defaultValue = "1") int page,
|
||||
@RequestParam(value = "limit", defaultValue = "20") int pageSize) {
|
||||
return RestResult.ok(bookService.searchByPage(bookSP, page, pageSize));
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ import java.util.List;
|
||||
public interface FrontBookMapper extends BookMapper {
|
||||
|
||||
|
||||
List<BookVO> searchByPage(@ValidateSortOrder BookSpVO params);
|
||||
List<BookVO> searchByPage(BookSpVO params);
|
||||
|
||||
void addVisitCount(@Param("bookId") Long bookId, @Param("visitCount") Integer visitCount);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.java2nb.novel.vo;
|
||||
|
||||
import com.java2nb.novel.core.vo.SortOrderVO;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
@ -10,7 +11,7 @@ import java.util.Date;
|
||||
* @author 11797
|
||||
*/
|
||||
@Data
|
||||
public class BookSpVO extends SortOrderVO {
|
||||
public class BookSpVO {
|
||||
|
||||
private String keyword;
|
||||
|
||||
@ -30,5 +31,8 @@ public class BookSpVO extends SortOrderVO {
|
||||
|
||||
private Long updatePeriod;
|
||||
|
||||
@Pattern(regexp = "^(last_index_update_time|word_count|visit_count)$")
|
||||
private String sort;
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user