mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2026-06-07 10:22:38 +08:00
api插件调用优化
This commit is contained in:
87
application/api/controller/Plugins.php
Normal file
87
application/api/controller/Plugins.php
Normal file
@ -0,0 +1,87 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user