use of com.zyd.blog.business.entity.Comment in project OneBlog by zhangyd-c.
the class RestCommentController method audit.
@RequiresPermissions("comment:audit")
@PostMapping("/audit")
@BussinessLog("审核评论")
public ResponseVO audit(Comment comment, String contentText, Boolean sendEmail) {
try {
commentService.updateSelective(comment);
if (!StringUtils.isEmpty(contentText)) {
comment.setContent(contentText);
commentService.commentForAdmin(comment);
}
if (null != sendEmail && sendEmail) {
Comment commentDB = commentService.getByPrimaryKey(comment.getId());
mailService.send(commentDB, TemplateKeyEnum.TM_COMMENT_AUDIT, true);
}
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error("评论审核失败!");
}
return ResultUtil.success(ResponseStatus.SUCCESS);
}
Aggregations