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 @@ +
+ +
+ {{if isset($data['is_default_tourist']) and $data['is_default_tourist'] eq 1}} + 是 + {{else /}} + 否 + {{/if}} +
+
+
diff --git a/application/plugins/view/touristbuy/admin/saveinfo.html b/application/plugins/view/touristbuy/admin/saveinfo.html index 24568104f..9cba80a60 100755 --- a/application/plugins/view/touristbuy/admin/saveinfo.html +++ b/application/plugins/view/touristbuy/admin/saveinfo.html @@ -30,6 +30,17 @@
+
+ +
+ {{foreach $is_whether_list as $v}} + + {{/foreach}} +
+
+
diff --git a/application/service/SystemService.php b/application/service/SystemService.php new file mode 100644 index 000000000..5a191482d --- /dev/null +++ b/application/service/SystemService.php @@ -0,0 +1,62 @@ + $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'; + $ret = Hook::listen($hook_name, [ + 'hook_name' => $hook_name, + 'is_backend' => true, + 'params' => &$params, + ]); + } +} +?> \ No newline at end of file diff --git a/application/tags.php b/application/tags.php index 734d0ff25..cad187d4c 100755 --- a/application/tags.php +++ b/application/tags.php @@ -13,6 +13,7 @@ return array ( 'app_init' => array ( + 0 => 'app\\plugins\\touristbuy\\Hook', ), 'app_begin' => array ( @@ -99,6 +100,10 @@ return array ( array ( 0 => 'app\\plugins\\expressforkdn\\Hook', ), + 'plugins_service_system_begin' => + array ( + 0 => 'app\\plugins\\touristbuy\\Hook', + ), 'plugins_view_header_navigation_top_left' => array ( 0 => 'app\\plugins\\touristbuy\\Hook',