Exemple #1
0
 public function index()
 {
     //最新发布文章
     $limit = 4;
     $article = new ArticleModel();
     $articles = $article->getArticlesByaddTime($limit);
     //var_dump($articles);
     //echo 123;
     $newArticle = array();
     foreach ($articles as $v) {
         $v['adminName'] = $this->getAdmin($v['adminId']);
         $v['time'] = $this->time_tran($v['addTime']);
         $newArticle[] = $v;
     }
     //var_dump($newArticle);
     $collect = new CollectModel();
     $collects = $collect->getCollectByArticleId($limit);
     //echo 456;
     $arr = array();
     foreach ($collects as $v) {
         $a = $article->getArticleById($v['articleId']);
         //$a['adminName']=$this->getAdmin($a['adminId']);
         $arr[] = $a;
     }
     //var_dump($arr);
     $album = new AlbumModel();
     $albums = $album->getAlbumByAddTime($limit);
     $admin = new AdminModel();
     $adm = $admin->getAllAdminInfo();
     $job = array('chief' => '首席咨询师', 'ordinary' => '普通咨询师', 'founding' => '联合创始人', 'senior' => '高级咨询师');
     $admins = array();
     foreach ($adm as $v) {
         $v['job'] = $job[$v['jobTitle']];
         $admins[] = $v;
     }
     //echo 789;
     // var_dump($newArticle);
     //var_dump($albums);
     // var_dump($admins);
     //最新文章
     $this->assign('articles', $newArticle);
     //精选文章
     $this->assign('choices', $arr);
     //最新相册
     $this->assign('albums', $albums);
     //所有的博主
     $this->assign('admins', $admins);
     $this->display();
 }