public function create()
 {
     $comment = new Comment();
     $count = $comment->where('article_id=' . $_POST['article_id'])->count();
     $data = $_POST;
     $data['created_at'] = date("Y-m-d H:i:s", time());
     $data['updated_at'] = date("Y-m-d H:i:s", time());
     if ($comment->add($data)) {
         // $mod = new Article;
         // $article = $mod->where('article_id='.$_POST['article_id'])->find();
         // $msg = '文章:['.$article['title'].'] 下有新的评论:'.$_POST['content'];
         //评论成功后给管理员发邮件
         // sendMail('*****@*****.**','有人发表评论',$msg);
         //  session('home.success_msg','评论成功');
         // //$this->success('评论成功');
         // $this->redirect('Article/show',array('id'=>$_POST['article_id']), 0, '');
         $item = array('ret' => 0, 'data' => $data, 'key' => $count + 1);
         $this->ajaxReturn($item);
     } else {
         $this->ajaxReturn(array('ret' => 1));
     }
 }
 /**
  *动作: 删除文章
  **/
 public function delete()
 {
     $article = new Article();
     $comments = new Comment();
     $id = $_GET['id'];
     $comments->where('article_id=' . $id)->delete();
     $article->where('article_id=' . $id)->delete();
     $data = array('ret' => 0, 'msg' => '删除成功');
     $this->ajaxReturn($data);
 }
 /**
  *动作: 删除评论
  **/
 public function delete()
 {
     $comment = new Comment();
     $id = $_GET['id'];
     if ($comment->where('id=' . $id)->delete()) {
         $data = array('ret' => 0, 'msg' => '删除成功');
         $this->ajaxReturn($data);
     }
 }