Пример #1
0
 public function removeAction()
 {
     if (!$this->user) {
         $this->flashJson(403);
         return;
     }
     $commentId = intval($this->request->getPost('comment_id'));
     if ($commentId < 1) {
         $this->flashJson(500, array(), "非法请求");
         return;
     }
     $commentModel = CommentModel::findFirst($commentId);
     if (empty($commentModel)) {
         $this->flashJson(500, array(), "该评论不存");
         return;
     }
     if ($this->user->id != $commentModel->user_id) {
         $this->flashJson(500, array(), "您没有权限删除别人的评论");
         return;
     }
     $this->flashJson(200);
     return;
 }