|
@@ -16,12 +16,10 @@ import com.fdkankan.site.request.CommentsSearchParam;
|
|
|
import com.fdkankan.site.request.MenuParam;
|
|
|
import com.fdkankan.site.service.ICommentsService;
|
|
|
import com.fdkankan.site.service.IMenuService;
|
|
|
+import com.fdkankan.site.service.IProjectService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.util.List;
|
|
|
import java.util.Optional;
|
|
@@ -37,7 +35,8 @@ public class CommentController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
ICommentsService commentsService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ IProjectService projectService;
|
|
|
|
|
|
/**
|
|
|
* 获取评论树结构
|
|
@@ -51,9 +50,11 @@ public class CommentController extends BaseController {
|
|
|
/**
|
|
|
* 回复评论
|
|
|
*/
|
|
|
- @PostMapping("/reply")
|
|
|
- public ResultData Reply(@RequestBody Comments param){
|
|
|
+ @PostMapping("/reply/{projectId}")
|
|
|
+ public ResultData Reply(@RequestBody Comments param, @PathVariable Integer projectId){
|
|
|
// VUtils.isTure(param.getParentId() == null).throwMessage(ResultCode.PARAM_MISS);
|
|
|
+ projectService.checkTokenPer(getToken(), projectId);
|
|
|
+
|
|
|
if (Optional.ofNullable(param.getCommentId()).isPresent()){
|
|
|
log.info("不为空修改");
|
|
|
commentsService.updateById(param);
|
|
@@ -71,9 +72,10 @@ public class CommentController extends BaseController {
|
|
|
return ResultData.ok();
|
|
|
}
|
|
|
|
|
|
- @PostMapping("/del")
|
|
|
- public ResultData del(@RequestBody Comments param){
|
|
|
+ @PostMapping("/del/{projectId}")
|
|
|
+ public ResultData del(@RequestBody Comments param, @PathVariable Integer projectId){
|
|
|
VUtils.isTure(param.getCommentId() == null).throwMessage(ResultCode.PARAM_MISS);
|
|
|
+ projectService.checkTokenPer(getToken(), projectId);
|
|
|
commentsService.delComments(param.getCommentId(),getUserId());
|
|
|
return ResultData.ok();
|
|
|
}
|