38 lines
1.4 KiB
PHP
38 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace app\controller;
|
|
|
|
use app\service\Layui;
|
|
use app\model\{Category, Block};
|
|
use think\Paginator;
|
|
|
|
class Page extends Base
|
|
{
|
|
public function index()
|
|
{
|
|
//动态设置当前分页驱动
|
|
app('think\App')->bind(Paginator::class, Layui::class);
|
|
|
|
$categoryId = $this->request->param("category_id");
|
|
$category = Category::getById($this->request->param("category_id"));
|
|
|
|
if ($category) {
|
|
//$description = $category['description'] ? $category['description'] : $this->system['seo_description'];
|
|
$description = $category['description'] ? $category['description'] : $category['title'];
|
|
$keywords = $category['seo_keywords'] ? $category['seo_keywords'] : $category['title'];
|
|
//$this->setSeo($category['title'], $this->system['seo_keywords'], $description);
|
|
$this->setSeo($category['title'] . "-" . $this->system['company_name'], $keywords, $description);
|
|
} else {
|
|
return $this->error('错误页面');
|
|
}
|
|
$childCategory = Category::getChildrenByParentId($categoryId);
|
|
|
|
$this->data['categoryId'] = $categoryId;
|
|
$this->data['category'] = $category;
|
|
$this->data['childCategory'] = $childCategory;
|
|
$this->data['blocks'] = Block::getByCategoryId($categoryId);
|
|
return $this->view($category['template_detail']);
|
|
}
|
|
|
|
|
|
} |