test_lgq/niucloud/core/dict/UniappComponent.php

41 lines
1.5 KiB
PHP
Raw Normal View History

2024-01-24 17:36:08 +08:00
<?php
// +----------------------------------------------------------------------
// | Niucloud-admin 企业快速开发的saas管理平台
// +----------------------------------------------------------------------
// | 官方网址https://www.niucloud-admin.com
// +----------------------------------------------------------------------
// | niucloud团队 版权所有 开源版本可自由商用
// +----------------------------------------------------------------------
// | Author: Niucloud Team
// +----------------------------------------------------------------------
namespace core\dict;
use app\service\admin\addon\AddonService;
class UniappComponent extends BaseDict
{
/**
* 系统uniapp组件配置
* @param array $data //系统
* @return array|mixed
*/
public function load(array $data)
{
$addons = (new AddonService())->getAddonKeysBySiteId(request()->siteId());
$components_files = [];
foreach ($addons as $v) {
$components_path = $this->getAddonDictPath($v) . "diy" . DIRECTORY_SEPARATOR . "components.php";
if (is_file($components_path)) {
$components_files[] = $components_path;
}
}
$components_files_data = $this->loadFiles($components_files);
$components = $data;
foreach ($components_files_data as $file_data) {
$components = empty($components) ? $file_data : array_merge2($components, $file_data);
}
return $components;
}
}