This commit is contained in:
Edward Yang 2022-07-13 11:43:25 +08:00
parent cf20f93917
commit cc3932a9f5
1 changed files with 22 additions and 0 deletions

View File

@ -11,6 +11,8 @@
namespace Beike\Admin\Services;
use Illuminate\Support\Facades\File;
class FileManagerService
{
private $fileBasePath = '';
@ -136,10 +138,30 @@ class FileManagerService
return [
'path' => $folderPath,
'name' => $baseName,
'leaf' => $this->hasSubFolders($folderPath),
];
}
/**
* 检测是否含有子文件夹
*
* @param $folderPath
* @return bool
*/
private function hasSubFolders($folderPath): bool
{
$path = public_path("catalog/{$folderPath}");
$subFiles = glob($path . '/*');
foreach ($subFiles as $subFile) {
if (is_dir($subFile)) {
return true;
}
}
return false;
}
/**
* 处理文件
*