fix: rollback declare commentList api for cms usage

main
wangqing 9 months ago
parent e9d2ef059b
commit dc0083e0f9

@ -92,7 +92,24 @@ public class CommentController extends BaseController {
* ,parentID2
* @return
*/
@ApiOperation(value = "根据期刊ID获取分页评论列表(废除),用最新和热门两个接口,可以默认用热门展示",notes = "根据期刊ID获取根节点评论分页列表 数据库中保存的有期刊号的都是根节点期刊号为空的代表有父评论且parentID一定有值拿到当然根节点评论列表每个根评论有 commentCount字段页面可以显示有 280个回复然后根据 @GetMapping(\"/comment/{parentId}/{page}/{size}\") 接口分页拿到该评论下的子评论列表页面在请求添加评论的时候当给评论添加子评论的时候父评论parentID有值就无法添加子评论并且不显示回复2字控制到两级")
@ApiImplicitParams({@ApiImplicitParam(name = "journalId", value = "剘刊id", required = true),
@ApiImplicitParam(name = "page", value = "分页: 页码以1开始", required = true),
@ApiImplicitParam(name = "size", value = "分页: 每页数量", required = true)})
@GetMapping("/{journalId}/{page}/{size}")
public Result findAllByJournalId(@PathVariable String journalId,@PathVariable int page,@PathVariable int size, @RequestHeader(value = "Authorization", required = false) String authorization) {
//验证是否登录并且拿到ID
UserLoginDto userLoginDto = getUserLoginDto(authorization);
if (null == userLoginDto) {
Page<Comment> pageList = commentService.findByJournalId(journalId,page,size);
List<CommentResp> list =pageList.stream().map(x->getCommentResp(x,"")).collect(Collectors.toList());
return Result.success(new PageResult<CommentResp>(Long.valueOf(list.size()),list));
}
String userId = userLoginDto.getUserId();
Page<Comment> pageList = commentService.findByJournalId(journalId,page,size);
List<CommentResp> list =pageList.stream().map(x->getCommentResp(x,userId)).collect(Collectors.toList());
return Result.success(new PageResult<CommentResp>(Long.valueOf(list.size()),list));
}
@ApiOperation(value = "根据期刊ID获取分页评论列表热门,按点赞数倒序",notes = "根据期刊ID获取根节点评论分页列表 数据库中保存的有期刊号的都是根节点期刊号为空的代表有父评论且parentID一定有值拿到当然根节点评论列表每个根评论有 commentCount字段页面可以显示有 280个回复然后根据 @GetMapping(\"/comment/{parentId}/{page}/{size}\") 接口分页拿到该评论下的子评论列表页面在请求添加评论的时候当给评论添加子评论的时候父评论parentID有值就无法添加子评论并且不显示回复2字控制到两级")

Loading…
Cancel
Save