2019-03-18 13:52:52 +08:00
|
|
|
<?php
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | ShopXO 国内领先企业级B2C免费开源电商系统
|
|
|
|
// +----------------------------------------------------------------------
|
2021-03-16 10:34:52 +08:00
|
|
|
// | Copyright (c) 2011~2099 http://shopxo.net All rights reserved.
|
2019-03-18 13:52:52 +08:00
|
|
|
// +----------------------------------------------------------------------
|
2021-03-16 10:34:52 +08:00
|
|
|
// | Licensed ( https://opensource.org/licenses/mit-license.php )
|
2019-03-18 13:52:52 +08:00
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
// | Author: Devil
|
|
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\service;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 配置服务层
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 0.0.1
|
|
|
|
* @datetime 2016-12-01T21:51:08+0800
|
|
|
|
*/
|
|
|
|
class SystemService
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* 系统运行开始
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-03-18
|
|
|
|
* @desc description
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
public static function SystemBegin($params = [])
|
|
|
|
{
|
2021-10-30 22:47:49 +08:00
|
|
|
// 当前用户生成uuid并存储
|
2021-11-01 13:43:37 +08:00
|
|
|
self::SetUserUUId($params);
|
|
|
|
|
|
|
|
// 分享标识处理
|
|
|
|
self::SetShareReferrer($params);
|
2021-10-30 22:47:49 +08:00
|
|
|
|
|
|
|
// 钩子
|
2019-03-18 13:52:52 +08:00
|
|
|
$hook_name = 'plugins_service_system_begin';
|
2021-07-18 23:42:10 +08:00
|
|
|
MyEventTrigger($hook_name, [
|
2019-03-18 13:52:52 +08:00
|
|
|
'hook_name' => $hook_name,
|
|
|
|
'is_backend' => true,
|
|
|
|
'params' => &$params,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 系统运行结束
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-03-18
|
|
|
|
* @desc description
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
public static function SystemEnd($params = [])
|
|
|
|
{
|
|
|
|
$hook_name = 'plugins_service_system_end';
|
2021-07-18 23:42:10 +08:00
|
|
|
MyEventTrigger($hook_name, [
|
2019-03-18 13:52:52 +08:00
|
|
|
'hook_name' => $hook_name,
|
|
|
|
'is_backend' => true,
|
|
|
|
'params' => &$params,
|
|
|
|
]);
|
|
|
|
}
|
2021-07-18 23:42:10 +08:00
|
|
|
|
2021-11-01 13:43:37 +08:00
|
|
|
/**
|
|
|
|
* 分享标识处理
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-03-18
|
|
|
|
* @desc description
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
public static function SetShareReferrer($params = [])
|
|
|
|
{
|
|
|
|
// 推荐人
|
|
|
|
if(!empty($params['referrer']))
|
|
|
|
{
|
|
|
|
MySession('share_referrer_id', $params['referrer']);
|
|
|
|
cookie('share_referrer_id', $params['referrer']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-30 22:47:49 +08:00
|
|
|
/**
|
|
|
|
* 当前用户生成uuid并存储
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2019-03-18
|
|
|
|
* @desc description
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
public static function SetUserUUId($params = [])
|
|
|
|
{
|
|
|
|
$uuid = MySession('uuid');
|
|
|
|
if(empty($uuid))
|
|
|
|
{
|
|
|
|
MySession('uuid', UUId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-18 23:42:10 +08:00
|
|
|
/**
|
|
|
|
* 系统安装检查
|
|
|
|
* @author Devil
|
|
|
|
* @blog http://gong.gg/
|
|
|
|
* @version 1.0.0
|
|
|
|
* @date 2021-07-18
|
|
|
|
* @desc description
|
|
|
|
* @param [array] $params [输入参数]
|
|
|
|
*/
|
|
|
|
public static function SystemInstallCheck($params = [])
|
|
|
|
{
|
|
|
|
if(!file_exists(ROOT.'config/database.php'))
|
|
|
|
{
|
|
|
|
MyRedirect(__MY_URL__.'install.php?s=index/index', true);
|
|
|
|
}
|
|
|
|
}
|
2019-03-18 13:52:52 +08:00
|
|
|
}
|
|
|
|
?>
|