1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- <?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\facade\Config;
- use think\App;
- use app\model\Article;
- use app\model\Category;
- use think\facade\Env;
- class Base extends BaseController
- {
- /**
- * seo
- */
- protected $seo = [];
- /**
- * makeHtmlFile
- */
- protected $html = false;
- /**
- * 构造方法
- * @access public
- * @param App $app 应用对象
- */
- public function __construct(App $app)
- {
- parent::__construct($app);
-
- // 控制器初始化
- $this->initialize();
- }
- // 初始化
- protected function initialize()
- {
- // SEO标题
- $system = \app\model\System::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);
- }
- // 栏目菜单(nav)
- $categories = Category::getList(['is_nav'=>1]);
- View::assign('categories', $categories);
-
- // 一般栏目
- $cate_lists = Category::getList(['type'=>1]);
- View::assign('cate_lists', $cate_lists);
- }
- }
|