diff --git a/app/Http/Requests/Admin/GroupRequest.php b/app/Http/Requests/Admin/GroupRequest.php index 5f3f7e6a..b86eae55 100644 --- a/app/Http/Requests/Admin/GroupRequest.php +++ b/app/Http/Requests/Admin/GroupRequest.php @@ -43,7 +43,7 @@ class GroupRequest extends FormRequest 'exclude_if:configs.is_enable_scan,false', 'in:mark,delete', ], - 'configs.scan_configs.driver' => ['exclude_if:configs.is_enable_scan,false', 'in:aliyun',], + 'configs.scan_configs.driver' => ['exclude_if:configs.is_enable_scan,false', 'in:aliyun'], 'configs.scan_configs.drivers.aliyun.access_key_id' => [$requiredIfReview('aliyun')], 'configs.scan_configs.drivers.aliyun.access_key_secret' => [$requiredIfReview('aliyun')], 'configs.scan_configs.drivers.aliyun.biz_type' => [$requiredIfReview('aliyun')], diff --git a/app/Utils.php b/app/Utils.php index 46b739f0..5ff788e6 100644 --- a/app/Utils.php +++ b/app/Utils.php @@ -151,7 +151,8 @@ class Utils */ public static function parseConfigs(array $defaults, array $configs): array { - $array = array_replace_recursive($defaults, Utils::filter($configs)); + $configs = Utils::filter($configs); + $array = self::array_merge_recursive_distinct($defaults, $configs); array_walk_recursive($array, function (&$item) { if (ctype_digit($item)) { $item += 0; @@ -162,4 +163,24 @@ class Utils }); return $array; } + + /** + * @param array $array1 + * @param array $array2 + * + * @return array + */ + private static function array_merge_recursive_distinct(array $array1, array &$array2): array + { + $merged = $array1; + foreach ($array2 as $key => &$value) { + if (is_array($value) && isset($merged[$key]) && is_array($merged[$key]) && ! array_is_list($value)) { + $merged[$key] = self::array_merge_recursive_distinct($merged[$key], $value); + } else { + $merged[$key] = $value; + } + } + + return $merged; + } } diff --git a/resources/views/components/upload.blade.php b/resources/views/components/upload.blade.php index c9c2fc2a..18223cec 100644 --- a/resources/views/components/upload.blade.php +++ b/resources/views/components/upload.blade.php @@ -1,5 +1,5 @@
- +

Image Upload