48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			PHP
		
	
	
		
			Executable File
		
	
| <?php
 | |
| 
 | |
| namespace app\controller;
 | |
| 
 | |
| use app\model\{Block, Category, PositionModel};
 | |
| 
 | |
| use think\Paginator;
 | |
| 
 | |
| class Position extends Base
 | |
| {
 | |
| 
 | |
|     //详情
 | |
|     public function detail($id = 0)
 | |
|     {
 | |
|         if ($id <= 0) {
 | |
|             return $this->error('错误页面');
 | |
|         }
 | |
|         $article = PositionModel::getById($id);
 | |
|         if (empty($article)) {
 | |
|             return $this->error('无此内容');
 | |
|         }
 | |
| 
 | |
| 
 | |
|         $category = Category::getById($article['category_id']);
 | |
| 
 | |
|         $description = $category['seo_description'] ?: $this->system['seo_description'];
 | |
|         $keywords    = $category['seo_keywords'] ?: $this->system['seo_keywords'];
 | |
|         $title       = $category['seo_title'] ?: $category['title'].' | '.$this->system['seo_title'];
 | |
| 
 | |
|         $this->setSeo($title, $keywords, $description);
 | |
| 
 | |
|         $parentBlocks = Block::getByCategoryId($category['parent_id']);
 | |
|         $parentBlocks = Block::convertValue($parentBlocks);
 | |
| 
 | |
|         $this->data['item']          = $article;
 | |
|         $this->data['category']      = $category;
 | |
| //        $blocks                      = Block::getByCategoryId($category['id']);
 | |
| //        $blocks                      = Block::convertValue($blocks);
 | |
| //        $this->data['blocks']        = $blocks;
 | |
|         $this->data['parentBlocks']        = $parentBlocks;
 | |
|         $this->data['categoryId']    = $category['id'];
 | |
|         $this->data['categoryPath']  = Category::categoryPath($category['path']);
 | |
|         $this->data['topCategoryId'] = Category::firstGradeId($category['path'], $category['id']);
 | |
|         return $this->view('/article/join_detail');
 | |
|     }
 | |
| 
 | |
| 
 | |
| } |