public function index() { $flinkinfo = getFriendLinks(); $this->assign('flinkinfo', $flinkinfo); $this->assign('titleOfIndex', 'FeedBack'); $this->display(); }
/** * @desc 好友说说和我的说说 */ public function index() { $sql = D('Personal'); $id = $_SESSION['user']['id']; $mySmallTalk = $sql->getSmallTalk(array(0, $id)); $friends = explode(',', $_SESSION['user']['friends']); $len = count($friends); //$friends[$len] = $_SESSION['user']['id']; //dump($friends);exit; //dump($_SESSION['user']['friends']);exit; $friendsSmallTalk = $sql->getSmallTalk($friends); //dump($friendsSmallTalk);exit; //dump($mySmallTalk);exit; //分页 :结果:不能显示每条说说下的评论 2015-4-9 /* $smallTaklModel = D('small_talk'); $countF = count($friendsSmallTalk); $pageF = new \Think\Page($countF,3); $showF = $pageF->show(); $friendSTList = $smallTaklModel->where('user_id IN ('.$_SESSION['user']['friends'].')')->order('pubtime desc')->limit($pageF->firstRow.',' .$pageF->listRows)->cache(true)->select(); //dump($friendSTList);exit; //dump($showF);exit; * */ /* * 说说按时间进行排序 最近的显示在前面:结果:排序出错不能显示 2015-4-9 * uasort($friendsSmallTalk,function($a,$b){ return $a['pubtime']>$b['pubtime']?-1:1; }); uasort($mySmallTalk,function($a,$b){ return $a['pubtime']>$b['pubtime']?-1:1; }); $friendsSmallTalk = array_map(function(&$v){ if($v['pubtime']<(time()-3600*24*3)){ unset($v); return; } return $v; },$friendsSmallTalk); foreach($friendsSmallTalk as $k=>$v){ if(!$v){ unset($friendsSmallTalk[$k]); } }*/ //dump($friendsSmallTalk);exit; //dump($mySmallTalk);exit; $user = D('User'); $user->clearStatus($id); //dump($mySmallTalk);exit; // dump($friendsSmallTalk); $flinkinfo = getFriendLinks(); $this->assign('flinkinfo', $flinkinfo); $this->assign('titleOfIndex', 'Personal Center'); $this->assign('mySmallTalk', $mySmallTalk); $this->assign('friendsSmallTalk', $friendsSmallTalk); //$this->assign('friendsSmallTalk',$friendSTList);//分页测试 //$this->assign('showF',$showF);//分页测试 $this->display('Personal/index'); }
public function blogInfo() { $blogModel = D('Blog'); $blog = $blogModel->where('id=' . I('get.id'))->cache(true)->find(); if ($blog) { //获取博客信息 $userModel1 = D('User'); $userinfo = $userModel1->where('id=' . I('get.user_id'))->cache(true)->find(); $blog['name'] = $userinfo['name']; $blog['user_pic'] = $userinfo['headpic']; $blog['user_intro'] = $userinfo['intro']; //dump($blog);exit; /* //获取类似博客 $common = getSearchResult($blog['title'],'Blog','title|content',5); if($common){ foreach($common as $k=>$v){ $sql1 = D("User"); $row = $sql1->where('id='.$v['user_id'])->getField('name,headpic'); $name = array_keys($row); $headpic = array_values($row); $common[$k]['name'] = $name[0]; $common[$k]['headpic'] = $headpic[0]; } }*/ //显示评论数最多的三条 $mosthot = $this->getMostCommentBlog($blogModel); //获取回复信息 $blogCommentModel = D("BlogComment"); $rs = $blogCommentModel->where('blog_id=' . $blog['id'])->cache(true)->select(); if ($rs) { foreach ($rs as $k => $v) { $userModel2 = D("User"); $row = $userModel2->where(array('id' => $v['user_id']))->field('name,headpic')->cache(true)->find(); $rs[$k]['name'] = $row['name']; $rs[$k]['headpic'] = $row['headpic']; } $this->assign('comment', $rs); } //分配数据,赋值 $flinkinfo = getFriendLinks(); //获取友情链接 $this->assign('flinkinfo', $flinkinfo); $this->assign('titleOfIndex', 'Essays Info'); //$this->assign('common',$common); $this->assign('mosthot', $mosthot); $this->assign('blog', $blog); $this->display(); } else { $this->redirect('Blog/index'); } }
/** * @desc 风景详情 */ public function detail() { $id = I('get.id', 1); //博文Id $land = D('Landscape'); $l = $land->cache(true)->where(array('id' => $id, 'in_trash' => 0, 'is_display' => 1))->myselect(); $lPic = $l[0]['pic']; //dump($lPic);exit; //获取该博文的评论 $comment = D("LandComment"); $landComment = $comment->getComment($id); $flinkinfo = getFriendLinks(); $this->assign('flinkinfo', $flinkinfo); $this->assign('titleOfIndex', 'Scenery Detail'); $this->assign('landComment', $landComment); $this->assign('land', $l[0]); //景点 $this->assign('landPic', $lPic); //景点图片 $this->display(); }