$dir, 'path' => $path, 'file' => $filename, 'url' => $dir.$path.$filename, ]; } /** * 配置信息初始化 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 * @date 2021-04-22 * @desc description */ public static function ConfigInit() { // 根据插件类型获取不通的配置信息 switch(self::$params['plugins_type']) { // 功能插件 case 'plugins' : $config = PluginsAdminService::GetPluginsConfig(self::$params['plugins_value']); if(empty($config) || empty($config['base'])) { return DataReturn('应用插件配置信息有误', -1); } self::$params['plugins_config'] = $config; self::$params['plugins_ver'] = $config['base']['version']; self::$params['plugins_author'] = $config['base']['author']; break; // 支付插件 case 'payment' : $config = PaymentService::GetPaymentConfig(self::$params['plugins_value']); if(empty($config)) { return DataReturn('支付插件配置信息有误', -1); } self::$params['plugins_config'] = $config['base']; self::$params['plugins_ver'] = $config['base']['version']; self::$params['plugins_author'] = $config['base']['author']; break; // web主题 case 'webtheme' : $config = ThemeService::ThemeConfig(self::$params['plugins_value']); if($config['code'] != 0) { return $config; } self::$params['plugins_config'] = $config['data']; self::$params['plugins_ver'] = $config['data']['ver']; self::$params['plugins_author'] = $config['data']['author']; break; // 小程序主题 case 'minitheme' : if(empty(self::$params['plugins_terminal'])) { return DataReturn('未指定终端类型', -1); } self::$params['application_name'] = self::$params['plugins_terminal']; $config = AppMiniService::MiniThemeConfig(self::$params['plugins_value'], self::$params); if($config['code'] != 0) { return $config; } self::$params['plugins_config'] = $config['data']; self::$params['plugins_ver'] = $config['data']['ver']; self::$params['plugins_author'] = $config['data']['author']; break; // 默认 default : return DataReturn('插件操作类型未定义['.self::$params['plugins_type'].']', -1); } return DataReturn('success', 0); } /** * 输入参数校验 * @author Devil * @blog http://gong.gg/ * @version 1.0.0 * @date 2021-04-22 * @desc description * @param [array] $params [输入参数] */ public static function ParamsCheck($params = []) { // 请求参数 $p = [ [ 'checked_type' => 'empty', 'key_name' => 'plugins_type', 'error_msg' => '更新类型有误', ], [ 'checked_type' => 'empty', 'key_name' => 'plugins_value', 'error_msg' => '插件标识有误', ], [ 'checked_type' => 'in', 'key_name' => 'opt', 'checked_data' => ['url', 'download', 'upgrade'], 'error_msg' => '操作类型有误', ], ]; $ret = ParamsChecked($params, $p); if($ret !== true) { return DataReturn($ret, -1); } // 下载和安装需要校验key if(in_array($params['opt'], ['download', 'upgrade']) && empty($params['key'])) { return DataReturn('操作key有误', -1); } self::$params = $params; return DataReturn('success', 0); } } ?>