<?php<364666827@qq.com>,开发者QQ群:50304283
namespace app\system\home;
use app\common\controller\Common;
use app\system\model\SystemPlugins as PluginsModel;
class Plugins extends Common
{
public function _empty()
{
$params = $this->request->param('');
if (!isset($params['_p'])) {
return $this->error('缺少参数[_p]');
}
$plugin = $params['_p'];
if (isset($params['_c']) && !empty($params['_c'])) {
$controller = ucfirst($params['_c']);
} else {
$controller = 'Index';
}
if (isset($params['_a']) && !empty($params['_a'])) {
$action = $params['_a'];
} else {
$action = 'Index';
}
$_GET['_p'] = $plugin;
$_GET['_c'] = $controller;
$_GET['_a'] = $action;
$params = $this->request->except(['_p', '_c', '_a'], 'param');
if (empty($plugin)) {
return $this->error('插件参数传递错误!');
}
if (!PluginsModel::where(['name' => $plugin, 'status' => 2])->find() ) {
return $this->error("插件可能不存在或者未安装!");
}
if (!plugins_action_exist($plugin.'/'.$controller.'/'.$action, 'home')) {
return $this->error("插件方法不存在[".$plugin.'/'.$controller.'/'.$action."]!");
}
return plugins_run($plugin.'/'.$controller.'/'.$action, $params, 'home');
}
}