From d5210ed1b2bf0249575f97fa946f8280db9eac70 Mon Sep 17 00:00:00 2001 From: linyaostalker <602604991@qq.com> Date: Tue, 10 Dec 2019 15:33:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8E=E5=8F=B0=E5=95=86=E5=93=81=E5=88=86?= =?UTF-8?q?=E7=B1=BB=E5=A2=9E=E5=8A=A0=E7=88=B6=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/goods/models/searchs/CategorySearch.php | 11 +++++++++++ 1 file changed, 11 insertions(+) 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',