| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | namespace app\controller; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-01 09:30:15 +08:00
										 |  |  | use app\model\{Category, Block, Article, Slide}; | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | class Index extends Base | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     public function index() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $category = Category::getIndex(); | 
					
						
							|  |  |  |         $categoryId = $category['id'] ?? 0; | 
					
						
							|  |  |  |         $this->data['categoryId'] = $categoryId; | 
					
						
							|  |  |  |         $this->setSeo($this->system['seo_title'], $this->system['seo_keywords'], $this->system['seo_description']); | 
					
						
							| 
									
										
										
										
											2020-11-25 18:48:29 +08:00
										 |  |  |         $blocks = Block::getByCategoryId($categoryId); | 
					
						
							|  |  |  |         $blocks = Block::analysisBlock($blocks); | 
					
						
							|  |  |  |         $this->data['blocks'] = $blocks; | 
					
						
							| 
									
										
										
										
											2020-12-01 09:30:15 +08:00
										 |  |  |         // 轮播图
 | 
					
						
							|  |  |  |         $this->data['slides'] = Slide::getList(); | 
					
						
							| 
									
										
										
										
											2020-12-17 10:14:38 +08:00
										 |  |  |         // 营销网络栏目ID
 | 
					
						
							| 
									
										
										
										
											2020-12-03 13:47:57 +08:00
										 |  |  |         $this->data['marketingCId'] = Category::$CIdList['marketing']; | 
					
						
							| 
									
										
										
										
											2020-12-17 10:14:38 +08:00
										 |  |  |         // 关联产品分类
 | 
					
						
							|  |  |  | 		$productsCenterCId = Category::$CIdList['products']; | 
					
						
							|  |  |  | 		$this->data['productsCenter'] = Category::getById($productsCenterCId); | 
					
						
							|  |  |  | 		$this->data['products'] = Category::getChildrenByParentId($productsCenterCId); | 
					
						
							| 
									
										
										
										
											2020-12-03 16:06:33 +08:00
										 |  |  |         // 关联新闻
 | 
					
						
							|  |  |  |         $this->data['newsCenter'] =  Category::getById(Category::$CIdList['news']); | 
					
						
							|  |  |  |         $newsCIdList = [Category::$CIdList['news_children']['enterprise'], Category::$CIdList['news_children']['industry']]; | 
					
						
							|  |  |  |         $newsList = Category::getListByIds($newsCIdList); | 
					
						
							|  |  |  |         foreach ($newsList as &$cate) { | 
					
						
							| 
									
										
										
										
											2020-12-04 18:22:07 +08:00
										 |  |  |             $cate['items'] = Article::getLatestByCategory($cate['id'], 4, 1); | 
					
						
							| 
									
										
										
										
											2020-12-03 16:06:33 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         unset($cate); | 
					
						
							|  |  |  |         $this->data['newsList'] = $newsList; | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  |         return $this->view(); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |