<?php
namespace app\index\controller;
use app\index\controller\Common;
use app\service\ApiService;
use app\service\PluginsService;
use app\service\ResourcesService;
* 应用调用入口
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2016-12-01T21:51:08+0800
*/
class Plugins extends Common
{
* 构造方法
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2018-11-30
* @desc description
*/
public function __construct()
{
parent::__construct();
}
* 首页
* @author Devil
* @blog http://gong.gg/
* @version 0.0.1
* @datetime 2017-02-22T16:50:32+0800
*/
public function Index()
{
$params = $this->GetClassVars();
$p = [
[
'checked_type' => 'empty',
'key_name' => 'pluginsname',
'error_msg' => MyLang('plugins_name_tips'),
],
];
$ret = ParamsChecked($params['data_request'], $p);
if($ret !== true)
{
if(IS_AJAX)
{
return ApiService::ApiDataReturn(DataReturn($ret, -5000));
} else {
MyViewAssign('msg', $ret);
return MyView('public/tips_error');
}
}
$params['data_request']['pluginscontrol'] = empty($params['data_request']['pluginscontrol']) ? 'index' : $params['data_request']['pluginscontrol'];
$params['data_request']['pluginsaction'] = empty($params['data_request']['pluginsaction']) ? 'index' : $params['data_request']['pluginsaction'];
$pluginsname = $params['data_request']['pluginsname'];
$pluginscontrol = strtolower($params['data_request']['pluginscontrol']);
$pluginsaction = strtolower($params['data_request']['pluginsaction']);
MyViewAssign('editor_path_type', ResourcesService::EditorPathTypeValue('plugins_'.$pluginsname));
$ret = PluginsService::PluginsControlCall($pluginsname, $pluginscontrol, $pluginsaction, 'index', $params);
if(IS_AJAX)
{
return ApiService::ApiDataReturn(($ret['code'] == 0) ? $ret['data'] : $ret);
}
if($ret['code'] == 0)
{
return $ret['data'];
}
MyViewAssign('msg', $ret['msg']);
return MyView('public/tips_error');
}
* 获取类属性数据
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-06-07
* @desc description
*/
public function GetClassVars()
{
$data = [];
$vers = get_class_vars(get_class($this));
foreach($vers as $k=>$v)
{
if(property_exists($this, $k))
{
$data[$k] = $this->$k;
}
}
return $data;
}
}
?>