function rss() { if (!empty($_GET['id'])) { $uid = (int) $_GET['id']; $user = App\Func::getUser($uid); $_mblog = createModel('MicroBlog'); $_blog = createModel('UserLogs'); $gets['uid'] = $uid; $gets['select'] = 'id,content,addtime'; $gets['limit'] = 10; $mblogs = $_mblog->gets($gets); foreach ($mblogs as &$v) { $v['title'] = strip_tags(App\Func::mblog_link($v['id'], $v['content'], 30, true)); $v['content'] = nl2br($v['content']); $v['url'] = WEBROOT . '/mblog/detail/' . $v['id']; } $gets['uid'] = $uid; $gets['select'] = 'id,title,content,addtime'; $gets['limit'] = 10; $gets['dir'] = 0; $blogs = $_blog->gets($gets); $list = array_merge($mblogs, $blogs); usort($list, 'Func::time_sort'); foreach ($list as &$v) { $v['addtime'] = date('r', strtotime($v['addtime'])); if (empty($v['url'])) { $v['url'] = WEBROOT . '/blog/detail/' . $v['id']; } } $this->swoole->tpl->ref('user', $user); $this->swoole->tpl->ref('list', $list); $this->swoole->tpl->display('blog_rss.xml'); } }
function detail() { if (!isset($_GET['id'])) { exit; } $id = (int) $_GET['id']; $model = model('MicroBlog'); $_u = model('UserInfo'); $_c = model('UserComment'); $comments = $_c->getByAid('mblog', $id); $mblog = $model->get($id)->get(); $this->userinfo($mblog['uid']); $mblog['addtime'] = date('n月j日 H:i', strtotime($mblog['addtime'])); $this->swoole->tpl->assign('mblog', $mblog); $title = strip_tags(App\Func::mblog_link(0, $mblog['content'], 32, true)); $this->swoole->tpl->assign('title', $title); $this->swoole->tpl->assign('comments', $comments); $this->swoole->tpl->display(); }