|
@@ -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;
|