Ejemplo n.º 1
0
 /**
  * 收藏动态
  * @return <type>
  */
 public function store()
 {
     $post = $this->get_data();
     $statuses_id = $post['id'];
     if (empty($statuses_id)) {
         $this->send_response(400, NULL, '400:对象id为空');
     }
     $doc = $this->feedModel->findFeed($statuses_id);
     if (!$doc) {
         $this->send_response(404, NULL, '该动态不存在');
     }
     $act = $post['act'];
     if ($act != 'add' && $act != 'del') {
         $this->send_response(400, NULL, '400:参数不正确');
     }
     if ($act == 'add') {
         if ($this->feedModel->addStorage($statuses_id)) {
             $this->send_response(200);
         }
         $this->send_response(400, NULL, '收藏失败');
     } else {
         if ($this->feedModel->delStorage($statuses_id)) {
             $this->send_response(200);
         }
         $this->send_response(400, NULL, '取消收藏失败');
     }
 }