Ejemplo n.º 1
0
  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, "审核失败");
    }
  }