* @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); } }