Selaa lähdekoodia

fix-113-把空文件夹也显示在容器树中

kely 7 kuukautta sitten
vanhempi
säilyke
8291bab617
1 muutettua tiedostoa jossa 10 lisäystä ja 6 poistoa
  1. 10 6
      app/Services/Folder/VersionFileTreeByObjectService.php

+ 10 - 6
app/Services/Folder/VersionFileTreeByObjectService.php

@@ -136,13 +136,17 @@ class VersionFileTreeByObjectService {
 
         $this->fileIds = explode(",", $containerContent->files);
 
-        if ($this->fileIds) {
-            $containerFolders = File::query()->whereIn("id", $this->fileIds)->pluck("folder_id")->filter()->unique();
-
-            Folder::query()->whereIn("id", $containerFolders->toArray())->pluck("path")->each(function ($item) {
+        Folder::query()->where("object_type", "container")->where("object_id",$containerContent->container_id)->pluck("path")->each(function ($item) {
                 $this->folderIds = [...$this->folderIds, ...explode(",", trim($item, ","))];
-            });
-        }
+        });
+
+//        if ($this->fileIds) {
+//            $containerFolders = File::query()->whereIn("id", $this->fileIds)->pluck("folder_id")->filter()->unique();
+//
+//            Folder::query()->whereIn("id", $containerFolders->toArray())->pluck("path")->each(function ($item) {
+//                $this->folderIds = [...$this->folderIds, ...explode(",", trim($item, ","))];
+//            });
+//        }
 
         if (! $this->objectVersion) {
             $this->objectVersion = $this->object->version;