예제 #1
0
 @Before(UCodeInterceptor.class)
 public void trash() {
   Comment c = CommentQuery.findById(getParaToBigInteger("id"));
   if (c != null) {
     c.setStatus(Comment.STATUS_DELETE);
     c.saveOrUpdate();
     renderAjaxResultForSuccess("success");
   } else {
     renderAjaxResultForError("trash error!");
   }
 }
예제 #2
0
 @Before(UCodeInterceptor.class)
 public void restore() {
   BigInteger id = getParaToBigInteger("id");
   Comment c = CommentQuery.findById(id);
   if (c != null && c.isDelete()) {
     c.setStatus(Content.STATUS_DRAFT);
     c.saveOrUpdate();
     renderAjaxResultForSuccess("success");
   } else {
     renderAjaxResultForError("restore error!");
   }
 }
예제 #3
0
 @Before(UCodeInterceptor.class)
 public void delete() {
   BigInteger id = getParaToBigInteger("id");
   final Comment c = CommentQuery.findById(id);
   if (c != null) {
     if (c.delete()) {
       MessageKit.sendMessage(Actions.COMMENT_DELETE, c);
       renderAjaxResultForSuccess();
       return;
     }
   }
   renderAjaxResultForError();
 }
예제 #4
0
 @Before(UCodeInterceptor.class)
 public void pub() {
   BigInteger id = getParaToBigInteger("id");
   Comment c = CommentQuery.findById(id);
   if (c != null) {
     c.setStatus(Content.STATUS_NORMAL);
     if (c.saveOrUpdate()) {
       MessageKit.sendMessage(Actions.COMMENT_UPDATE, c);
       renderAjaxResultForSuccess("success");
     } else {
       renderAjaxResultForError("pub fail!");
     }
   } else {
     renderAjaxResultForError("pub error!");
   }
 }
예제 #5
0
  @Override
  public void save() {
    Comment comment = getModel(Comment.class);
    String username = getPara("username");
    if (StringUtils.isNotBlank(username)) {
      User user = User.DAO.findUserByUsername(username);
      if (user == null) {
        renderAjaxResultForError("系统没有该用户:" + username);
        return;
      }
      comment.setUserId(user.getId());
    }

    comment.saveOrUpdate();

    renderAjaxResultForSuccess("ok");
  }