@@ -10,6 +10,7 @@ public enum ResultCode {
IDEXIST(10001, "书籍 ID 已存在"),
PARAMERROR(10002, "参数错误"),
ORDER_FAIL(10003, "下单失败"),
+ USER_NULL(10004, "用户 ID 不能为 null"),
;
private Integer code;
@@ -136,6 +136,9 @@ public class BookController extends BaseController {
*/
@PostMapping("/content")
public Result<BookContent> getBookContentByChapter(@RequestBody BookContentVO bookContentVO) {
+ if (bookContentVO.getUserId() == null) {
+ return Result.failure(ResultCode.USER_NULL);
+ }
return bookService.getContentByContentId(bookContentVO);
}