12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- <?php
- /**
- * BaseController.php UTF-8
- * 推广后台公共类
- *
- * @date : 2018/2/27 16:02
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : ouzhongfu <ozf@huosdk.com>
- * @version : HUOSDK 7.2
- */
- namespace agent\common\controller;
- use think\Session;
- class BaseController extends \cmf\controller\BaseController {
- protected $web_info = [];
- public function _initialize() {
- Session::boot();
- $this->common_assign();
- parent::_initialize();
- }
- // 初始化视图配置
- protected function _initializeView() {
- $cmfAdminThemePath = config('cmf_theme_path');
- $cmfAdminDefaultTheme = config('cmf_default_theme');
- $themePath = "{$cmfAdminThemePath}{$cmfAdminDefaultTheme}";
- $root = cmf_get_root();
- //使cdn设置生效
- $cdnSettings = cmf_get_option('cdn_settings');
- if (empty($cdnSettings['cdn_static_root'])) {
- $viewReplaceStr = [
- '__ROOT__' => $root,
- '__TMPL__' => "{$root}/{$themePath}",
- '__STATIC__' => STATICSITE,
- '__WEB_ROOT__' => $root
- ];
- } else {
- $cdnStaticRoot = rtrim($cdnSettings['cdn_static_root'], '/');
- $viewReplaceStr = [
- '__ROOT__' => $root,
- '__TMPL__' => "{$cdnStaticRoot}/{$themePath}",
- '__STATIC__' => "{$cdnStaticRoot}",
- '__WEB_ROOT__' => $cdnStaticRoot
- ];
- }
- $viewReplaceStr = array_merge(config('view_replace_str'), $viewReplaceStr);
- config('template.view_base', "$themePath/");
- config('view_replace_str', $viewReplaceStr);
- }
- /**
- * 设置通用内容
- */
- public function common_assign() {
- $_path = $this->request->path();
- $_selected = [
- '1' => 'active',
- '2' => '',
- '3' => '',
- '4' => '',
- ];
- if (strpos($_path, 'notice/index') !== false) {
- $_selected = [
- '1' => '',
- '2' => '',
- '3' => 'active',
- '4' => '',
- ];
- } elseif (strpos($_path, 'management/index') !== false) {
- $_selected = [
- '1' => '',
- '2' => 'active',
- '3' => '',
- '4' => '',
- ];
- } elseif (strpos($_path, 'document/index') !== false) {
- $_selected = [
- '1' => '',
- '2' => '',
- '3' => '',
- '4' => 'active',
- ];
- } elseif (strpos($_path, 'notice/read') !== false) {
- $_selected = [
- '1' => '',
- '2' => '',
- '3' => 'active',
- '4' => '',
- ];
- }
- $this->assign('selected', $_selected);
- }
- }
|