public function actionIndex() { //友情链接 $friendLink = new FriendLink(); $friendLinks = $friendLink->getFriendLinks(); $num = ceil(count($friendLinks) / 8); for ($i = 0; $i < count($friendLinks); $i++) { $newFriendLinks[floor($i / 8)][] = $friendLinks[$i]; } // p($newFriendLinks[0][1]); //学术会议和展览展会 $meetingModel = new MirMeeting(); $xueshuMeetings = $meetingModel->find()->select("meeting_id,meeting_name,meeting_bdate")->where(["meeting_class" => '1'])->orderBy('meeting_id desc')->limit(5)->all(); $zhanhuiMeetings = $meetingModel->find()->select("meeting_id,meeting_name,meeting_bdate")->where(["meeting_class" => '2'])->orderBy('meeting_id desc')->limit(5)->all(); $meetingModel = new MirMeeting(); //新闻中心 $articleModel = new MirArticle(); $news = $articleModel->articleToIndex(0); //招标公告 $zhaobiao = $articleModel->articleToIndex(2); //技术分享 $jishus = $articleModel->articleToIndex(3); // p($zhaobiao); //临床医学 $ivdModel = new MirIvd(); $linchuangyixues = $ivdModel->getIvdlist(3); $pinpaililiang = $ivdModel->getIvdlist(1); $zhutizhuanfang = $ivdModel->getIvdlist(2); $zhuanjiazhuanlan = $ivdModel->getIvdlist(4); // p($linchuangyixues); // 把主题专访 四个合并成一个 $firstData[] = $linchuangyixues; $firstData[] = $zhutizhuanfang; $firstData[] = $zhuanjiazhuanlan; $firstData[] = $pinpaililiang; // p($firstData); // p($linchuangyixues); // IVD展厅 $porduct = new MirProduct(); $porducts = MirProduct::find()->orderBy("product_id desc")->limit(5)->all(); // p($porducts[0]->product_pic); //索刊 $mgzModel = new MirMgz(); $mgz = $mgzModel->find()->orderBy("mgz_id desc")->groupBy("mgz_year,mgz_num")->all(); for ($i = 0; $i < count($mgz); $i++) { $mgzYear[] = $mgz[$i]->mgz_year; $mgzNum[] = $mgz[$i]->mgz_num; } $fourPic = $porduct->find()->andWhere(["!=", "product_pic", "productnopic.gif"])->orderBy("product_id desc")->limit(4)->all(); // p($fourPic); //获得视屏中心的照片 $videoModel = new MirVideo(); $videos = $videoModel->find()->orderBy("video_id desc")->all(); return $this->render('index', ['newFriendLinks' => $newFriendLinks, 'zhanhuiMeetings' => $zhanhuiMeetings, 'xueshuMeetings' => $xueshuMeetings, 'news' => $news, 'zhaobiao' => $zhaobiao, 'jishus' => $jishus, 'firstData' => $firstData, 'porducts' => $porducts, 'mgzYear' => $mgzYear, 'mgzNum' => $mgzNum, 'fourPic' => $fourPic, 'videos' => $videos]); }
public function actionIndex() { $classifyModel = new Classify(); $dafenlei = $classifyModel->find()->where(["ParentID" => '0'])->limit(8)->all(); // p($dafenlei); $articleModel = new MirArticle(); $jobs = $articleModel->articleToIndex(5); //技术分享 $jishus = $articleModel->articleToIndex(3); $productModel = new MirProduct(); //ivd 五个广告图 $adModel = new MirAd(); $ads = $adModel->find()->orderBy("ad_rank desc,id desc")->limit(5)->all(); // p($ads); // p($fourPic); // P($ivdList); // p(count($ivdList)); //产品照片显示 $mainClass = $productModel->mainClass(); foreach ($mainClass as $k => $v) { $mainClassId[] = $k; } for ($i = 0; $i < count($mainClassId) - 1; $i++) { $products[] = MirProduct::find()->where(['product_mainclass' => $mainClassId[$i]])->orderBy("product_rank desc,product_id desc")->limit(9)->all(); $data = $productModel->find()->where(["product_mainclass" => $mainClassId[$i]]); $pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '10']); $dataShow = $data->offset($pages->offset)->limit($pages->limit)->orderBy("product_rank desc,product_id desc")->all(); $pagesArray[] = $pages; $productArray[] = $dataShow; } // p(count($products[1])); // p($pagesArray); // p($productArray); $mainClass = array_values($mainClass); return $this->render('index', ['dafenlei' => $dafenlei, 'jobs' => $jobs, 'jishus' => $jishus, 'ivdList' => $ivdList, 'mainClass' => $mainClass, 'products' => $products, 'productArray' => $productArray, 'pagesArray' => $pagesArray, 'ads' => $ads]); }
public function actionIndex() { //新闻中心 $articleModel = new MirArticle(); $data = $articleModel->find()->where(["article_class" => '0'])->orderBy("article_rank desc"); $pages = new Pagination(['totalCount' => $data->count(), 'pageSize' => '10']); $news = $articleModel->articleToIndex(0); $news = $data->offset($pages->offset)->limit($pages->limit)->orderBy("article_rank desc,article_id desc")->all(); // p(count($news)); // 本周热点 $renDian = $articleModel->find()->where(["article_class" => '0', 'article_istop' => '1'])->all(); // p($renDian); //热门排行 $paiHang = $articleModel->find()->where(["article_class" => '0', 'article_istop' => '0'])->orderBy("article_id desc")->all(); // p($paiHang); return $this->render('index', ['news' => $news, 'pages' => $pages, 'renDian' => $renDian, 'paiHang' => $paiHang]); }