12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- <?php
- declare(strict_types=1);
- /**
- * @file Index.php
- * @date 2019-02-27 14:49:36
- * @author huwhis<huuwhois>
- * @version 0.0.6
- */
- namespace app\controller;
- use app\BaseController;
- use think\facade\View;
- use think\App;
- use think\facade\Cache;
- use think\facade\Env;
- use app\model\Category;
- use app\model\System;
- class Base extends BaseController
- {
- /**
- * seo
- */
- protected $seo = [];
- /**
- * makeHtmlFile
- */
- protected $html = false;
- /**
- * 构造方法
- * @access public
- * @param App $app 应用对象
- */
- public function __construct(App $app)
- {
- parent::__construct($app);
- }
- // 初始化
- protected function initialize()
- {
- $system = System::cache('system', 3600)->find(1);
- $this->seo = [
- 'title' => $system['title'],
- 'key' => $system['key'],
- 'des' => $system['des']
- ];
- View::assign('seo', $this->seo);
- if (Env::get('app.app_env', false)=='dev') {
- View::assign('bdtongji', "");
- } else {
- View::assign('bdtongji', $system['tongji']);
- }
- // 栏目
- $categoryList = Cache::get('category_list');
- if (!$categoryList) {
- $categoryList = Category::getList();
- Cache::set("category_list",$categoryList, 3600);
- }
- View::assign('categoryList', $categoryList);
- }
- }
|