Skip to content

Commit 195498b

Browse files
authored
Update Service.php
1 parent 6b818a7 commit 195498b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

src/addons/Service.php

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ private function loadApp()
239239
if (in_array($childname, ['.', '..', 'public', 'view'])) {
240240
continue;
241241
}
242+
242243
if (in_array($childname, ['vendor'])) {
243244
$autoload_file = $this->addons_path . $name . DS . $childname.DS.'autoload.php';
244245
if (file_exists($autoload_file)){
@@ -251,11 +252,26 @@ private function loadApp()
251252
if (in_array($mdir, ['.', '..'])) {
252253
continue;
253254
}
255+
//加载配置
254256
$commands = [];
255257
//配置文件
256-
$addons_config_dir = $this->addons_path . $name . DS . $childname . DS . 'config' . DS;
257-
if (is_dir($addons_config_dir)) {
258-
$files = glob($addons_config_dir . '*.php');
258+
$addon_config_dir = $this->addons_path . $name . DS . 'config' . DS;
259+
if (is_dir($addon_config_dir)) {
260+
$files = glob($addon_config_dir . '*.php');
261+
foreach ($files as $file) {
262+
if (file_exists($file)) {
263+
if (substr($file, -11) == 'console.php') {
264+
$commands_config = include_once $file;
265+
isset($commands_config['commands']) && $commands = array_merge($commands, $commands_config['commands']);
266+
!empty($commands) && $this->commands($commands);
267+
}
268+
}
269+
}
270+
}
271+
//配置文件
272+
$module_config_dir = $this->addons_path . $name . DS . $childname . DS . 'config' . DS;
273+
if (is_dir($module_config_dir)) {
274+
$files = glob($module_config_dir . '*.php');
259275
foreach ($files as $file) {
260276
if (file_exists($file)) {
261277
if (substr($file, -11) == 'console.php') {

0 commit comments

Comments
 (0)