diff --git a/application/api/controller/Common.php b/application/api/controller/Common.php index 1a8da279d..a7528d181 100755 --- a/application/api/controller/Common.php +++ b/application/api/controller/Common.php @@ -11,6 +11,7 @@ namespace app\api\controller; use think\Controller; +use app\service\SystemService; use app\service\ConfigService; use app\service\UserService; @@ -47,6 +48,9 @@ class Common extends Controller { parent::__construct(); + // 系统运行开始 + SystemService::SystemBegin(); + // 输入参数 $this->data_post = input('post.'); $this->data_get = input('get.'); @@ -62,6 +66,20 @@ class Common extends Controller $this->CommonInit(); } + /** + * 析构函数 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-03-18 + * @desc description + */ + public function __destruct() + { + // 系统运行结束 + SystemService::SystemEnd(); + } + /** * 系统初始化 * @author Devil diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index 79d5195ac..67a1a8d20 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -12,6 +12,7 @@ namespace app\index\controller; use think\facade\Hook; use think\Controller; +use app\service\SystemService; use app\service\GoodsService; use app\service\NavigationService; use app\service\BuyService; @@ -52,6 +53,9 @@ class Common extends Controller { parent::__construct(); + // 系统运行开始 + SystemService::SystemBegin(); + // 系统初始化 $this->SystemInit(); @@ -71,6 +75,20 @@ class Common extends Controller $this->CommonPluginsInit(); } + /** + * 析构函数 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-03-18 + * @desc description + */ + public function __destruct() + { + // 系统运行结束 + SystemService::SystemEnd(); + } + /** * 公共钩子初始化 * @author Devil diff --git a/application/plugins/touristbuy/Hook.php b/application/plugins/touristbuy/Hook.php index f487cc80a..902f29bf4 100644 --- a/application/plugins/touristbuy/Hook.php +++ b/application/plugins/touristbuy/Hook.php @@ -11,6 +11,7 @@ namespace app\plugins\touristbuy; use think\Controller; +use app\plugins\touristbuy\Service; use app\service\PluginsService; use app\service\UserService; @@ -59,6 +60,11 @@ class Hook extends Controller $ret = $this->NavTitle($params); break; + // 系统运行开始 + case 'plugins_service_system_begin' : + $ret = $this->SystemBegin($params); + break; + default : $ret = DataReturn('无需处理', 0); } @@ -70,6 +76,26 @@ class Hook extends Controller } } + /** + * 系统运行开始 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2019-03-18 + * @desc description + * @param [array] $params [输入参数] + */ + public function SystemBegin($params = []) + { + // 是否开启默认游客 + $ret = PluginsService::PluginsData('touristbuy'); + if($ret['code'] == 0 && isset($ret['data']['is_default_tourist']) && $ret['data']['is_default_tourist'] == 1) + { + return Service::TouristReg(); + } + return DataReturn('无需处理', 0); + } + /** * css * @author Devil diff --git a/application/plugins/touristbuy/config.json b/application/plugins/touristbuy/config.json index 97f25f2e2..c61090e48 100644 --- a/application/plugins/touristbuy/config.json +++ b/application/plugins/touristbuy/config.json @@ -17,6 +17,9 @@ "is_home":true }, "hook":{ + "plugins_service_system_begin":[ + "app\\plugins\\touristbuy\\Hook" + ], "plugins_common_header":[ "app\\plugins\\touristbuy\\Hook" ], diff --git a/application/plugins/view/touristbuy/admin/index.html b/application/plugins/view/touristbuy/admin/index.html index 3ae512bf3..44c362849 100755 --- a/application/plugins/view/touristbuy/admin/index.html +++ b/application/plugins/view/touristbuy/admin/index.html @@ -50,6 +50,17 @@ +