Exemplo n.º 1
0
  // 更新评论
  @Override
  public int updateComment(long id, String content) {

    int code = 13024;

    try {
      Comment comment = commentDao.getComment(id);
      comment.setContent(content);
      if (commentDao.update(comment)) {
        code = 13021;
      } else {
        code = 13023;
      }

    } catch (Exception e) {
      e.printStackTrace();
    }

    return code;
  }
Exemplo n.º 2
0
  // 创建评论
  @Override
  public int newComment(long uid, long aid, String uname, String content) {

    int code = 13014;

    try {
      Comment comment = new Comment();
      comment.setUid(uid);
      comment.setUname(uname);
      comment.setAid(aid);
      comment.setCreatetime(new Timestamp(new Date().getTime()));
      comment.setContent(content);
      if (commentDao.insert(comment)) {
        code = 13011;
      } else {
        code = 13013;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return code;
  }