/** * 获取动态 * @return <type> */ public function index($uid = 0) { if (!$uid) { $uid = $this->uid; } $uptime = $this->input->get('uptime', 0); $pretime = $this->input->get('pretime', 0); $downtime = $this->input->get('downtime', 0); $pos = $this->input->get('pagesize', 20); $html = ''; $site = url::base(); switch ($this->feedType) { case 'all': $data = $this->feedModel->getFriendFeedNew($uid, $uptime, $pretime, $downtime, $pos, $this->type_id); break; case 'storage': $data = $this->feedModel->findStorageNew($uptime, $pretime, $downtime, $pos); break; case 'hidden': $data = $this->feedModel->findHiddenNew($uptime, $pretime, $downtime, $pos); break; case 'single': $data = $this->feedModel->getUserFeedNew($uid, $uptime, $pretime, $downtime, $pos, $this->type_id); } //出错处理 $html = array(); if ($data['code'] == 200) { if ($data['result']['count']) { // $tpldata = $this->feedModel->getFeedTpl (); foreach ($data['result']['data'] as $key => $val) { if ($val['last_updated'] == $uptime || $val['last_updated'] == $downtime) { continue; } if ($val['uid'] != $this->uid && $val['call'] && !in_array($this->uid, $val['call'])) { continue; } $html[] = $this->feedModel->new_feedview($val, 1, $this->source); } } unset($val); } $data = $this->feedType == 'all' || $this->feedType == 'single' ? array('data' => $html, 'delete' => $data['result']['delete']) : array('data' => $html); $this->send_response(200, $data); }