/** * 获取我mo的 */ public function my_mo() { $pos = $this->input->get('pagesize', 20); $start = $this->input->get('page', 1); $sms = $this->input->get('sms', 0); $pos = $pos > 100 ? 100 : $pos; $start = abs(($start - 1) * $pos); $arr = $this->feedModel->findMyMo($pos, $start, $sms); $res = array(); if ($arr) { $i = 0; foreach ($arr as $row) { if ($row['kind'] == 4 || $row['uid'] == Kohana::config('uap.xiaomo')) { continue; } $res[$i]['id'] = $row['_id']; $res[$i]['statuses_id'] = $row['feed_id']; $res[$i]['kind'] = $row['kind']; $res[$i]['sms'] = $this->_st($row['sms'], 0); $res[$i]['text'] = $this->_st(strip_tags(str_replace('提到我', '提到TA', $row['comment_content']))); $res[$i]['source'] = $row['source'] == 0 ? '' : $this->get_source($row['source']); $res[$i]['user'] = array('id' => $this->_st($row['uid'], 0), 'name' => $this->_st(sns::getrealname($row['uid'])), 'avatar' => sns::getavatar($row['uid'], 'small')); $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' => $content, '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(strip_tags($row['feed_content']), ''), 'at' => $row['feed_at']); } else { $content = $this->_st(strip_tags($row['feed_content']), ''); $aboutme_opt['statuses'] = array('text' => $content, 'at' => $row['feed_at'], 'uid' => $row['feed_uid'], 'name' => $row['feed_name']); } if (in_array($row['kind'], array(1, 3, 6))) { $aboutme_opt['comment'] = array('id' => $row['comment_id'], 'text' => $this->_st(strip_tags(str_replace(array('在评论中提到我:', '回复:'), array('', ''), $row['comment_content'])), ''), 'at' => $row['comment_at']); } $res[$i]['opt'] = $aboutme_opt; $i++; } } $this->send_response(200, $res); }