public String msgSave() { Msg msg = new Msg(); msg.setCtg(ctg); log.debug("留言标题:", title); String htmlTitle = StringEscapeUtils.escapeHtml(title); msg.setTitle(htmlTitle); log.debug("留言HTML标题:", msg.getTitle()); content = StrUtils.getCn(content, getConfig().getMsgMaxSize()); log.debug("留言内容", content); String htmlContent = StrUtils.txt2htm(content); msg.setContentMember(htmlContent); log.debug("留言HTML内容", msg.getContentMember()); msg.setEmail(email); msg.setWebsite(getWeb()); msg.setMember(getMember()); msg.setCreateTime(ComUtils.now()); msg.setCheck(false); msg.setRecommend(false); msg.setDisabled(false); String ip = contextPvd.getRemoteIp(); msg.setIp(ip); jsonRoot.put("success", true); boolean check = getConfig().getMsgNeedCheck(); jsonRoot.put("isNeedCheck", check); if (msgMng.isDuplicated(ip, htmlTitle, htmlContent)) { // 禁止重复留言 jsonRoot.put("msg", "你已写过类似留言,请等待回复。"); } else { msgMng.save(msg); if (check) { jsonRoot.put("msg", "留言成功,请等待审核。"); } else { jsonRoot.put("msg", "恭喜您,留言成功!"); } } return SUCCESS; }