Ejemplo n.º 1
0
 /**
  * 获取关于我的动态,提供iphone,andriod使用
  * @return <type>
  */
 public function aboutme_alone()
 {
     $pos = $this->input->get('pagesize', 20);
     $start = $this->input->get('page', 1);
     $new = $this->input->get('new', 0);
     $pos = $pos > 100 ? 100 : $pos;
     $start = abs(($start - 1) * $pos);
     $arr = $this->feedModel->findAboutme($new, $pos, $start);
     $res = array();
     if ($arr) {
         $i = 0;
         foreach ($arr as $row) {
             $res[$i]['id'] = $row['_id'];
             $res[$i]['statuses_id'] = $row['feed_id'];
             $res[$i]['kind'] = $row['kind'];
             $res[$i]['group'] = array('id' => $this->_st($row['group_id'], 0), 'name' => $this->_st($row['group_name'], ''));
             $res[$i]['text'] = $this->_st($this->feedModel->format_title($row['comment_content'], $this->source), '');
             $res[$i]['source'] = $row['source'] == 0 ? '' : $this->get_source($row['source']);
             $res[$i]['user'] = array('id' => $this->_st($row['comment_uid'], 0), 'name' => $this->_st(sns::getrealname($row['comment_uid'])), 'avatar' => sns::getavatar($row['comment_uid'], 'small'));
             $res[$i]['new'] = $row['new'] == 1 ? true : false;
             $res[$i]['created_at'] = ceil($row['addtime'] / 10000);
             $aboutme_opt = array();
             if ($row['kind'] == 6) {
                 $content = $this->_st(strip_tags($row['reply_content']), '');
                 $aboutme_opt['reply_source'] = array('id' => $row['reply_id'], 'text' => $this->feedModel->format_title($content, $this->source), 'at' => $row['reply_at'], 'user' => array('id' => $row['reply_uid'], 'name' => $row['reply_name'], 'avatar' => sns::getavatar($row['reply_uid'], 'small')));
             } elseif ($row['kind'] == 2) {
                 $aboutme_opt['message'] = array('text' => $this->_st($this->feedModel->format_title($row['feed_content'], $this->source), ''), 'at' => $row['feed_at']);
             } else {
                 $content = $this->_st(strip_tags($row['feed_content']), '');
                 $aboutme_opt['statuses'] = array('text' => $this->feedModel->format_title($content, $this->source), 'at' => $row['feed_at'], 'uid' => $this->_st($row['feed_uid'], 0), 'name' => $this->_st($row['feed_name']));
             }
             if (in_array($row['kind'], array(1, 3, 6))) {
                 $aboutme_opt['comment'] = array('id' => $row['comment_id'], 'text' => $this->_st($this->feedModel->format_title(str_replace(array('评论道:', '回复:'), '', $row['comment_content']), $this->source), ''), 'at' => $row['comment_at']);
             }
             $res[$i]['opt'] = $aboutme_opt;
             $i++;
         }
         $this->feedModel->updateAboutmeRead();
     }
     $this->send_response(200, $res);
 }