public void addAntiCount() { String ip = this.request.getClientIP(); String id = $V("ID"); Transaction trans = new Transaction(); ZCCommentSchema task = new ZCCommentSchema(); task.setID(id); task.fill(); String supportAntiIP = task.getSupportAntiIP(); if ((XString.isNotEmpty(supportAntiIP)) && (supportAntiIP.indexOf(ip) >= 0)) { this.response.setMessage("您已经评论过,谢谢支持!"); this.response.put("count", task.getAntiCount()); return; } long count = task.getAntiCount(); task.setAntiCount(count + 1L); task.setSupportAntiIP((XString.isEmpty(supportAntiIP) ? "" : supportAntiIP) + ip); trans.add(task, OperateType.UPDATE); if (trans.commit()) { this.response.setStatus(1); this.response.setMessage("您的评论提交成功!"); this.response.put("count", count + 1L); } else { this.response.setLogInfo(0, "审核失败"); } }
public void Verify() { String ID = $V("ID"); String Type = $V("Type"); String IDs = $V("IDs"); if ((XString.isNotEmpty(ID)) && (XString.isEmpty(IDs))) { ZCCommentSchema comment = new ZCCommentSchema(); comment.setID(ID); comment.fill(); if (Type.equals("Pass")) comment.setVerifyFlag("Y"); else if (Type.equals("NoPass")) { comment.setVerifyFlag("N"); } comment.setVerifyUser(User.getUserName()); comment.setVerifyTime(new Date()); if (comment.update()) this.response.setLogInfo(1, "审核成功"); else this.response.setLogInfo(0, "审核失败"); } else if ((XString.isNotEmpty(IDs)) && (XString.isEmpty(ID))) { ZCCommentSchema comment = new ZCCommentSchema(); ZCCommentSet set = comment.query(new QueryBuilder("where ID in (" + IDs + ")")); Transaction trans = new Transaction(); for (int i = 0; i < set.size(); i++) { comment = set.get(i); if (Type.equals("Pass")) comment.setVerifyFlag("Y"); else if (Type.equals("NoPass")) { comment.setVerifyFlag("N"); } comment.setVerifyUser(User.getUserName()); comment.setVerifyTime(new Date()); trans.add(comment, OperateType.UPDATE); } if (trans.commit()) this.response.setLogInfo(1, "审核成功"); else this.response.setLogInfo(0, "审核失败"); } }
public static Mapx initDetail(Mapx params) { String id = params.getString("ID"); if (XString.isNotEmpty(id)) { ZCCommentSchema comment = new ZCCommentSchema(); comment.setID(id); if (comment.fill()) { params.putAll(comment.toMapx()); params.put( "VerifyFlag", CacheManager.getMapx("Code", "Comment.Status").get(params.get("VerifyFlag"))); String addTimeStr = params.getString("AddTime"); params.put("AddTime", addTimeStr.substring(0, addTimeStr.lastIndexOf("."))); } } return params; }