diff --git a/application/admin/controller/Plugins.php b/application/admin/controller/Plugins.php index 64d4753bb..1b9b32ae1 100755 --- a/application/admin/controller/Plugins.php +++ b/application/admin/controller/Plugins.php @@ -10,6 +10,8 @@ // +---------------------------------------------------------------------- namespace app\admin\controller; +use app\service\PluginsService; + /** * 应用调用入口 * @author Devil @@ -76,7 +78,7 @@ class Plugins extends Common return DataReturn($ret, -5000); } else { $this->assign('msg', $ret); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } } @@ -85,6 +87,19 @@ class Plugins extends Common $pluginscontrol = strtolower($params['pluginscontrol']); $pluginsaction = strtolower($params['pluginsaction']); + // 应用校验 + $ret = $this->PluginsCheck($pluginsname, $pluginscontrol, $pluginsaction); + if($ret['code'] != 0) + { + if(IS_AJAX) + { + return $ret; + } else { + $this->assign('msg', $ret['msg']); + return $this->fetch('public/tips_error'); + } + } + // 视图初始化 $this->PluginsViewInit($pluginsname, $pluginscontrol, $pluginsaction); @@ -96,7 +111,7 @@ class Plugins extends Common if(!class_exists($plugins)) { $this->assign('msg', ucfirst($pluginscontrol).' 应用控制器未定义'); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } // 调用方法 @@ -104,11 +119,35 @@ class Plugins extends Common if(!method_exists($obj, $pluginsaction)) { $this->assign('msg', ucfirst($pluginsaction).' 应用方法未定义'); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } return $obj->$pluginsaction($params); } + /** + * 应用校验 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-05-27T00:13:50+0800 + * @param [string] $plugins_name [应用名称] + * @param [string] $plugins_control [控制器名称] + * @param [string] $plugins_action [方法] + */ + private function PluginsCheck($pluginsname, $pluginscontrol, $pluginsaction) + { + $ret = PluginsService::PluginsData($pluginsname); + if($ret['code'] == 0) + { + $is_enable = PluginsService::PluginsField($pluginsname, 'is_enable'); + if($is_enable['data'] != 1) + { + return DataReturn('应用异常或未启用', -10); + } + } + return $ret; + } + /** * 视图初始化 * @author Devil diff --git a/application/admin/controller/Pluginsadmin.php b/application/admin/controller/Pluginsadmin.php index 1a973c1f9..7bf0e575f 100755 --- a/application/admin/controller/Pluginsadmin.php +++ b/application/admin/controller/Pluginsadmin.php @@ -243,7 +243,7 @@ class Pluginsadmin extends Common if(isset($ret['code']) && $ret['code'] != 0) { $this->assign('msg', $ret['msg']); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } else { return $ret; } diff --git a/application/index/controller/Common.php b/application/index/controller/Common.php index aeff71fd3..296193bb5 100755 --- a/application/index/controller/Common.php +++ b/application/index/controller/Common.php @@ -317,7 +317,7 @@ class Common extends Controller exit(json_encode(DataReturn($name.' 非法访问', -1000))); } else { $this->assign('msg', $name.' 非法访问'); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } } diff --git a/application/index/controller/Error.php b/application/index/controller/Error.php index ea2b3b239..974553512 100755 --- a/application/index/controller/Error.php +++ b/application/index/controller/Error.php @@ -38,7 +38,7 @@ class Error extends Common exit(json_encode(DataReturn($request->controller().' 控制器不存在', -1000))); } else { $this->assign('msg', $request->controller().' 控制器不存在'); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } } } diff --git a/application/index/controller/Order.php b/application/index/controller/Order.php index 49c95213c..e14f5b766 100755 --- a/application/index/controller/Order.php +++ b/application/index/controller/Order.php @@ -244,10 +244,10 @@ class Order extends Common if($ret['code'] == 0) { $this->assign('msg', '支付成功'); - return $this->fetch('public/pay_success'); + return $this->fetch('public/tips_success'); } else { $this->assign('msg', $ret['msg']); - return $this->fetch('public/pay_error'); + return $this->fetch('public/tips_error'); } } diff --git a/application/index/controller/Plugins.php b/application/index/controller/Plugins.php index 7979cffdb..c6f20cad9 100755 --- a/application/index/controller/Plugins.php +++ b/application/index/controller/Plugins.php @@ -10,6 +10,8 @@ // +---------------------------------------------------------------------- namespace app\index\controller; +use app\service\PluginsService; + /** * 应用调用入口 * @author Devil @@ -70,7 +72,7 @@ class Plugins extends Common return DataReturn($ret, -5000); } else { $this->assign('msg', $ret); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } } @@ -79,6 +81,19 @@ class Plugins extends Common $pluginscontrol = strtolower($params['pluginscontrol']); $pluginsaction = strtolower($params['pluginsaction']); + // 应用校验 + $ret = $this->PluginsCheck($pluginsname, $pluginscontrol, $pluginsaction); + if($ret['code'] != 0) + { + if(IS_AJAX) + { + return $ret; + } else { + $this->assign('msg', $ret['msg']); + return $this->fetch('public/tips_error'); + } + } + // 视图初始化 $this->PluginsViewInit($pluginsname, $pluginscontrol, $pluginsaction); @@ -90,7 +105,7 @@ class Plugins extends Common if(!class_exists($plugins)) { $this->assign('msg', ucfirst($pluginscontrol).' 应用控制器未定义'); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } // 调用方法 @@ -98,11 +113,35 @@ class Plugins extends Common if(!method_exists($obj, $pluginsaction)) { $this->assign('msg', ucfirst($pluginsaction).' 应用方法未定义'); - return $this->fetch('public/error'); + return $this->fetch('public/tips_error'); } return $obj->$pluginsaction($params); } + /** + * 应用校验 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @datetime 2019-05-27T00:13:50+0800 + * @param [string] $plugins_name [应用名称] + * @param [string] $plugins_control [控制器名称] + * @param [string] $plugins_action [方法] + */ + private function PluginsCheck($pluginsname, $pluginscontrol, $pluginsaction) + { + $ret = PluginsService::PluginsData($pluginsname); + if($ret['code'] == 0) + { + $is_enable = PluginsService::PluginsField($pluginsname, 'is_enable'); + if($is_enable['data'] != 1) + { + return DataReturn('应用异常或未启用', -10); + } + } + return $ret; + } + /** * 视图初始化 * @author Devil diff --git a/application/index/view/default/public/error.html b/application/index/view/default/public/error.html deleted file mode 100755 index 1b914021c..000000000 --- a/application/index/view/default/public/error.html +++ /dev/null @@ -1,31 +0,0 @@ -{{include file="public/header" /}} - - -{{if isset($is_header) and $is_header eq 1}} - - {{include file="public/header_top_nav" /}} - - - {{include file="public/nav_search" /}} - - - {{include file="public/header_nav" /}} - - - {{include file="public/goods_category" /}} -{{/if}} - - - -