From 004ad3cccade236416bbf0d9648c8571ed72133e Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 28 Jun 2024 15:23:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4=E5=88=86=E7=B1=BB?= =?UTF-8?q?=E5=88=97=E8=A1=A8API=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/lists/cate/CateLists.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/app/api/lists/cate/CateLists.php b/app/api/lists/cate/CateLists.php index 7139e303d..688f56c77 100644 --- a/app/api/lists/cate/CateLists.php +++ b/app/api/lists/cate/CateLists.php @@ -48,20 +48,17 @@ class CateLists extends BaseAdminDataLists implements ListsSearchInterface $pid = $this->request->get('pid',0); $this->searchWhere[] = ['stock', '>', 0]; $this->searchWhere[] = ['status', '=', 1]; - if($pid == 0 && $level ==1){ - $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct() - ->column('top_cate_id'); - } if($pid && $level ==2){ $this->searchWhere[] = ['top_cate_id','=',$pid]; $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct() ->column('two_cate_id'); - } - - if($pid && $level ==3){ + }elseif($pid && $level ==3){ $this->searchWhere[] = ['two_cate_id','=',$pid]; $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct() ->column('cate_id'); + }else{ + $cate_arr = StoreBranchProduct::where($this->searchWhere)->distinct() + ->column('top_cate_id'); } $lists = []; if ($cate_arr) {