feat(novel-front): 增加评论用户地理位置显示功能

This commit is contained in:
xiongxiaoyang
2025-06-30 20:51:29 +08:00
parent efb136e3be
commit 4693c7ffae
16 changed files with 222 additions and 12 deletions

View File

@ -2,12 +2,14 @@ package com.java2nb.novel.controller;
import com.java2nb.novel.core.bean.UserDetails;
import com.java2nb.novel.core.enums.ResponseStatus;
import com.java2nb.novel.core.utils.IpUtil;
import com.java2nb.novel.entity.Book;
import com.java2nb.novel.entity.BookCategory;
import com.java2nb.novel.entity.BookComment;
import com.java2nb.novel.entity.BookIndex;
import com.java2nb.novel.service.BookContentService;
import com.java2nb.novel.service.BookService;
import com.java2nb.novel.service.IpLocationService;
import com.java2nb.novel.vo.BookCommentVO;
import com.java2nb.novel.vo.BookSettingVO;
import com.java2nb.novel.vo.BookSpVO;
@ -37,6 +39,8 @@ public class BookController extends BaseController {
private final Map<String, BookContentService> bookContentServiceMap;
private final IpLocationService ipLocationService;
/**
* 查询首页小说设置列表数据
*/
@ -158,6 +162,7 @@ public class BookController extends BaseController {
if (userDetails == null) {
return RestResult.fail(ResponseStatus.NO_LOGIN);
}
comment.setLocation(ipLocationService.getLocation(IpUtil.getRealIp(request)));
bookService.addBookComment(userDetails.getId(), comment);
return RestResult.ok();
}