@RequestMapping(value = "/member/comment_delete.jspx")
public String delete(Integer commentId, Integer userId, String ip,
Integer pageNo, String nextUrl, HttpServletRequest request,
HttpServletResponse response, ModelMap model) {
CmsSite site = CmsUtils.getSite(request);
CmsUser user = CmsUtils.getUser(request);
FrontUtils.frontData(request, model, site);
MemberConfig mcfg = site.getConfig().getMemberConfig();
// 没有开启会员功能
if (!mcfg.isMemberOn()) {
return FrontUtils.showMessage(request, model, "member.memberClose");
}
if (user == null) {
return FrontUtils.showLogin(request, model, site);
}
// 删除单条评论
CmsComment bean;
if (commentId != null) {
bean = commentMng.deleteById(commentId);
log.info("delete CmsComment id={}", bean.getId());
} else {
// 依据评论人或者评论ip删除评论
List<CmsComment> comments = commentMng.getListForDel(site.getId(),
user.getId(), userId, ip);
for (int i = 0; i < comments.size(); i++) {
bean = comments.get(i);
commentMng.deleteById(comments.get(i).getId());
log.info("delete CmsComment id={}", bean.getId());
}