Browse Source

Merge branch 'refs/heads/peterguo-dev' into dev

peterguo 1 month ago
parent
commit
3316007732
1 changed files with 3 additions and 1 deletions
  1. 3 1
      app/Http/Controllers/API/ContainerController.php

+ 3 - 1
app/Http/Controllers/API/ContainerController.php

@@ -220,7 +220,9 @@ class ContainerController extends Controller
 
     public function linkage(string $libraryId)
     {
-        $items = Container::withCount('folder')->allowed()->where("library_id", $libraryId)->get(['id', 'name'])->each(function ($items) {
+        $items = Container::withCount(['folder' => function ($query) {
+            $query->where('parent_id', 0);
+        }])->allowed()->where("library_id", $libraryId)->get(['id', 'name'])->each(function ($items) {
             // 设置固定的type值
             $items->type = 'container';
             $items->uniId=$items->type.'_'.$items->id;