wip
This commit is contained in:
parent
cf20f93917
commit
cc3932a9f5
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 处理文件
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue