diff --git a/backend/modules/goods/models/searchs/CategorySearch.php b/backend/modules/goods/models/searchs/CategorySearch.php index 969f1ac..cc0f5aa 100755 --- a/backend/modules/goods/models/searchs/CategorySearch.php +++ b/backend/modules/goods/models/searchs/CategorySearch.php @@ -55,6 +55,17 @@ class CategorySearch extends Category ], 'id', 'name', + [ + 'attribute' => 'pid', + 'value' => function ($model) { + $parentsCategory = Category::findOne($model->pid); + if ($parentsCategory) { + return $parentsCategory->name; + } else { + return '一级分类'; + } + } + ], ['attribute' => 'icon', 'contentOptions' => [ 'align' => 'center',