| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  | <?php | 
					
						
							|  |  |  | namespace app\controller; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | use app\model\{Category, Block}; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class Page extends Base | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2020-11-25 18:48:29 +08:00
										 |  |  |     private function getPageCommonData($categoryId) | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-11-25 18:48:29 +08:00
										 |  |  |         $resp = true; | 
					
						
							| 
									
										
										
										
											2020-11-25 20:15:51 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  |         return $resp; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // 默认单页页面
 | 
					
						
							|  |  |  |     public function index($categoryId) | 
					
						
							|  |  |  |     { | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  |         $category = Category::getById($categoryId); | 
					
						
							|  |  |  |         if ($category) { | 
					
						
							|  |  |  |             $description = $category['description'] ? $category['description'] : $this->system['seo_description']; | 
					
						
							|  |  |  |             $this->setSeo($category['title'], $this->system['seo_keywords'], $description); | 
					
						
							|  |  |  |         } else { | 
					
						
							| 
									
										
										
										
											2020-11-25 20:15:51 +08:00
										 |  |  |             return $this->error('页面错误'); | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         $childCategory = Category::getChildrenByParentId($categoryId); | 
					
						
							|  |  |  |         $this->data['categoryId'] = $categoryId; | 
					
						
							|  |  |  |         $this->data['category'] = $category; | 
					
						
							|  |  |  |         $this->data['childCategory'] = $childCategory; | 
					
						
							|  |  |  |         $this->data['blocks'] = Block::getByCategoryId($categoryId); | 
					
						
							| 
									
										
										
										
											2020-11-25 20:15:51 +08:00
										 |  |  |         return $this->view($category['template_detail']); | 
					
						
							| 
									
										
										
										
											2020-11-25 09:07:06 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } |