<?php
// +----------------------------------------------------------------------
// | hulacwms 3.0 呼啦企业网站管理系统
// +----------------------------------------------------------------------
// | Copyright (c) 2021 https://www.kaifashu.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 开发树
// +----------------------------------------------------------------------

namespace app\index\controller;
use think\Exception;
use think\facade\Env;
use think\addons\Service as AddonsService;

/**
 * 插件模块
 * Class Addons
 * @package app\index\controller
 */
class Addons extends Base
{
    /**
     * 插件执行代理
     * @return mixed
     */
    public function agent(){
        $param=$this->request->param();
        if(!$param['addon']||!$param['controller']||!$param['action']){
            $this->error('');
        }
        $class = get_addon_class($param['addon'],'controller', $param['controller']);
        if (!class_exists($class)) {
            $this->error('');
        }
        $controllers = new $class();
        return call_user_func_array([$controllers, $param['action']], ['config'=>$this->config,'member'=>isset($this->member)?$this->member:false]);
    }

}
