vr-shopxo-source/application/api/controller/Plugins.php

87 lines
2.5 KiB
PHP

<?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\api\controller;
use app\service\PluginsService;
/**
* 应用调用入口
* @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 2020-01-02
* @desc description
*/
public function __construct()
{
parent::__construct();
}
/**
* 首页
* @author Devil
* @blog http://gong.gg/
* @version 1.0.0
* @date 2020-01-02
* @desc description
*/
public function Index()
{
// 请求参数校验
$p = [
[
'checked_type' => 'empty',
'key_name' => 'pluginsname',
'error_msg' => '应用名称有误',
],
[
'checked_type' => 'empty',
'key_name' => 'pluginscontrol',
'error_msg' => '应用控制器有误',
],
[
'checked_type' => 'empty',
'key_name' => 'pluginsaction',
'error_msg' => '应用操作方法有误',
],
];
$ret = ParamsChecked($this->data_request, $p);
if($ret !== true)
{
return DataReturn($ret, -5000);
}
// 应用名称/控制器/方法
$pluginsname = $this->data_request['pluginsname'];
$pluginscontrol = strtolower($this->data_request['pluginscontrol']);
$pluginsaction = strtolower($this->data_request['pluginsaction']);
// 调用
$ret = PluginsService::PluginsControlCall($pluginsname, $pluginscontrol, $pluginsaction, 'api', $this->data_request);
if($ret['code'] == 0)
{
return $ret['data'];
}
// 调用失败
return $ret;
}
}
?>