提交 b0058d73 编写于 作者: D devil_gong

游客登录新增默认游客开关

上级 e39a0673
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -17,6 +17,9 @@
"is_home":true
},
"hook":{
"plugins_service_system_begin":[
"app\\plugins\\touristbuy\\Hook"
],
"plugins_common_header":[
"app\\plugins\\touristbuy\\Hook"
],
......
......@@ -50,6 +50,17 @@
</div>
</div>
<div class="items">
<label>默认游客登录</label>
<div>
{{if isset($data['is_default_tourist']) and $data['is_default_tourist'] eq 1}}
{{else /}}
{{/if}}
</div>
</div>
<div class="items">
<label>订单查询地址</label>
<div>
......
......@@ -30,6 +30,17 @@
<textarea rows="3" name="query_tips" class="am-radius am-field-valid" placeholder="公告内容" data-validation-message="请填写订单查询提示">{{if !empty($data['query_tips'])}}{{$data.query_tips}}{{/if}}</textarea>
</div>
<div class="am-form-group">
<label>默认游客登录<span class="am-form-group-label-tips">建议关闭</span></label>
<div>
{{foreach $is_whether_list as $v}}
<label class="am-radio-inline m-r-10">
<input type="radio" name="is_default_tourist" value="{{$v.id}}" {{if isset($data['is_default_tourist']) and $data['is_default_tourist'] eq $v['id']}}checked="checked"{{else /}}{{if !isset($data['is_default_tourist']) and isset($v['checked']) and $v['checked'] eq true}}checked="checked"{{/if}}{{/if}} data-am-ucheck /> {{$v.name}}
</label>
{{/foreach}}
</div>
</div>
<div class="am-form-group am-form-group-refreshing">
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm w100" data-am-loading="{loadingText:'处理中...'}">保存</button>
</div>
......
<?php
// +----------------------------------------------------------------------
// | ShopXO 国内领先企业级B2C免费开源电商系统
// +----------------------------------------------------------------------
// | Copyright (c) 2011~2019 http://shopxo.net All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: Devil
// +----------------------------------------------------------------------
namespace app\service;
use think\facade\Hook;
/**
* 配置服务层
* @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 = [])
{
$hook_name = 'plugins_service_system_begin';
$ret = Hook::listen($hook_name, [
'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';
$ret = Hook::listen($hook_name, [
'hook_name' => $hook_name,
'is_backend' => true,
'params' => &$params,
]);
}
}
?>
\ No newline at end of file
......@@ -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',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册