From b0b47c48c9cd79cd87d32eb93b4a31831b0eaf1c Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Mon, 22 Nov 2021 13:09:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=AC=E5=85=B1=E6=8E=A5=E5=8F=A3=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/PluginsService.php | 33 ++++++++++++++++++++++++++++++- app/service/QuickNavService.php | 2 +- app/service/SystemBaseService.php | 4 ++-- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/app/service/PluginsService.php b/app/service/PluginsService.php index ca33fd04a..d65c3604b 100755 --- a/app/service/PluginsService.php +++ b/app/service/PluginsService.php @@ -408,7 +408,38 @@ class PluginsService { foreach($data as &$v) { - $v['data'] = self::PluginsDataHandle($v['data']); + $private_field = []; + $attachment_field = []; + $plugins = '\app\plugins\\'.$v['plugins'].'\service\BaseService'; + if(class_exists($plugins)) + { + // 附件属性 + $attachment_field = property_exists($plugins, 'base_config_attachment_field') ? $plugins::$base_config_attachment_field : []; + + // 私有字段 + $private_field = property_exists($plugins, 'base_config_private_field') ? $plugins::$base_config_private_field : []; + } + + // 处理配置数据 + $v['data'] = self::PluginsDataHandle($v['data'], $attachment_field); + + // 移除私有字段及数据 + if(!empty($v['data']) && is_array($v['data']) && !empty($private_field) && is_array($private_field)) + { + foreach($private_field as $pv) + { + if(array_key_exists($pv, $v['data'])) + { + unset($v['data'][$pv]); + } + } + } + } + + // 是否返回插件标识为索引 + if(!empty($params) && isset($params['is_key']) && $params['is_key'] == 1) + { + $data = array_column($data, null, 'plugins'); } } else { $data = []; diff --git a/app/service/QuickNavService.php b/app/service/QuickNavService.php index a32aaecf3..b4add3aa1 100755 --- a/app/service/QuickNavService.php +++ b/app/service/QuickNavService.php @@ -264,7 +264,7 @@ class QuickNavService * @version 1.0.0 * @date 2018-11-19 * @desc description - * @param array $params [description] + * @param [array] $params [输入参数] */ public static function QuickNav($params = []) { diff --git a/app/service/SystemBaseService.php b/app/service/SystemBaseService.php index 30cb5ae9b..2b5af6507 100644 --- a/app/service/SystemBaseService.php +++ b/app/service/SystemBaseService.php @@ -191,10 +191,10 @@ class SystemBaseService 'currency_symbol' => ResourcesService::CurrencyDataSymbol(), // 快捷入口信息 - 'quick_nav' => QuickNavService::QuickNav(), + 'quick_nav' => QuickNavService::QuickNav($params), // 插件配置信息 - 'plugins_base' => PluginsService::PluginsBaseList(), + 'plugins_base' => PluginsService::PluginsBaseList($params), ]; // 公共配置信息钩子 -- GitLab