fix: 增加评论参数校验

This commit is contained in:
xiongxiaoyang 2022-05-20 09:41:13 +08:00
parent 747d2c9fc7
commit 339fcf6ddc
3 changed files with 2 additions and 3 deletions

View File

@ -137,5 +137,4 @@ public class BookController {
return bookService.listNewestComments(bookId);
}
}

View File

@ -75,7 +75,7 @@ public class UserController {
* 发表评论接口
* */
@PostMapping("comment")
public RestResp<Void> comment(@RequestBody UserCommentReqDto dto) {
public RestResp<Void> comment(@Valid @RequestBody UserCommentReqDto dto) {
dto.setUserId(UserHolder.getUserId());
return bookService.saveComment(dto);
}

View File

@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
/**
* 用户名序列化敏感信息不应该在页面上完全显示
* 用户名序列化敏感信息不应该在页面上完全显示
*
* @author xiongxiaoyang
* @date 2022/5/20