baodinzhihui/app/controller/Home.php

31 lines
962 B
PHP
Raw Normal View History

2021-08-09 02:38:25 +00:00
<?php
namespace app\controller;
use app\model\{Category, Block};
use think\facade\View;
class Home extends Base
{
protected $category_id;
protected function initialize()
{
parent::initialize(); // TODO: Change the autogenerated stub
$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']);
$this->data['blocks'] = Block::getByCategoryId($categoryId);
$this->category_id=$this->request->param("category_id/d");
}
//关于我们
public function aboutUs(){
$Block=["key1"=>"","key2"=>""];
$Block["key1"]=Block::getByKeyword(1,$this->category_id);
$Block["key2"]=Block::getByKeyword(2,$this->category_id);
dump($Block);
View::assign($Block);
return $this->view();
}
}