477 lines
16 KiB
PHP
Executable File
477 lines
16 KiB
PHP
Executable File
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed ( https://opensource.org/licenses/mit-license.php )
|
|
// +----------------------------------------------------------------------
|
|
// | Author: Devil
|
|
// +----------------------------------------------------------------------
|
|
namespace app\admin\controller;
|
|
|
|
use app\BaseController;
|
|
use app\module\FormHandleModule;
|
|
use app\service\SystemService;
|
|
use app\service\SystemBaseService;
|
|
use app\service\AdminService;
|
|
use app\service\AdminPowerService;
|
|
use app\service\ConfigService;
|
|
use app\service\ResourcesService;
|
|
use app\service\StoreService;
|
|
|
|
/**
|
|
* 管理员公共控制器
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 0.0.1
|
|
* @datetime 2016-12-01T21:51:08+0800
|
|
*/
|
|
class Common extends BaseController
|
|
{
|
|
// 管理员
|
|
protected $admin;
|
|
|
|
// 左边权限菜单
|
|
protected $left_menu;
|
|
|
|
// 输入参数 post|get|request
|
|
protected $data_post;
|
|
protected $data_get;
|
|
protected $data_request;
|
|
|
|
// 当前系统操作名称
|
|
protected $module_name;
|
|
protected $controller_name;
|
|
protected $action_name;
|
|
|
|
// 当前插件操作名称
|
|
protected $plugins_module_name;
|
|
protected $plugins_controller_name;
|
|
protected $plugins_action_name;
|
|
|
|
// 分页信息
|
|
protected $page;
|
|
protected $page_size;
|
|
|
|
// 动态表格
|
|
protected $form_table;
|
|
protected $form_where;
|
|
protected $form_params;
|
|
protected $form_md5_key;
|
|
protected $form_user_fields;
|
|
protected $form_order_by;
|
|
protected $form_error;
|
|
|
|
// 系统类型
|
|
protected $system_type;
|
|
|
|
/**
|
|
* 构造方法
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-11-30
|
|
* @desc description
|
|
*/
|
|
public function __construct()
|
|
{
|
|
// 检测是否是新安装
|
|
SystemService::SystemInstallCheck();
|
|
|
|
// 输入参数
|
|
$this->data_post = input('post.');
|
|
$this->data_get = input('get.');
|
|
$this->data_request = input();
|
|
|
|
// 系统初始化
|
|
$this->SystemInit();
|
|
|
|
// 管理员信息
|
|
$this->admin = AdminService::LoginInfo();
|
|
|
|
// 权限菜单
|
|
AdminPowerService::PowerMenuInit($this->admin);
|
|
$this->left_menu = AdminPowerService::MenuData($this->admin);
|
|
|
|
// 视图初始化
|
|
$this->ViewInit();
|
|
|
|
// 动态表格初始化
|
|
$this->FormTableInit();
|
|
|
|
// 公共钩子初始化
|
|
$this->CommonPluginsInit();
|
|
}
|
|
|
|
/**
|
|
* 系统初始化
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 1.0.0
|
|
* @date 2018-12-07
|
|
* @desc description
|
|
*/
|
|
private function SystemInit()
|
|
{
|
|
// 配置信息初始化
|
|
ConfigService::ConfigInit();
|
|
}
|
|
|
|
/**
|
|
* [IsLogin 登录校验]
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 0.0.1
|
|
* @datetime 2016-12-03T12:42:35+0800
|
|
*/
|
|
protected function IsLogin()
|
|
{
|
|
if(empty($this->admin))
|
|
{
|
|
if(IS_AJAX)
|
|
{
|
|
exit(json_encode(DataReturn('登录失效,请重新登录', -400)));
|
|
} else {
|
|
die('<script type="text/javascript">if(self.frameElement && self.frameElement.tagName == "IFRAME"){parent.location.reload();}else{window.location.href="'.MyUrl('admin/admin/logininfo').'";}</script>');
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* [ViewInit 视图初始化]
|
|
* @author Devil
|
|
* @blog http://gong.gg/
|
|
* @version 0.0.1
|
|
* @datetime 2016-12-03T12:30:06+0800
|
|
*/
|
|
public function ViewInit()
|
|
{
|
|
// 系统类型
|
|
$this->system_type = SystemService::SystemTypeValue();
|
|
MyViewAssign('system_type', $this->system_type);
|
|
|
|