From 195db1130e35d3397660f1ef3a774dae6f87408d Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 24 May 2024 16:10:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86GoodsclassLists?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E4=B8=80=E4=B8=AAbug=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86=E6=9F=A5=E8=AF=A2=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/IndexController.php | 3 ++- app/api/lists/goods/GoodsclassLists.php | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 3f74119..fdb009e 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -39,7 +39,8 @@ class IndexController extends BaseApiController // foreach($arr as $k=>$v){ // Goodsclass::where('id',$k)->update(['children'=>json_encode($v,true)]); // } - // $a=Goodsclass::where('pid','>',0)->where('children','<>',null)->column('id'); + $a=Goodsclass::where('pid',0)->where('children','<>',null)->column('id'); + d ($a); // $arr = []; // foreach ($a as $k => $v) { // $pid = Goodsclass::where('id', $v)->value('pid'); diff --git a/app/api/lists/goods/GoodsclassLists.php b/app/api/lists/goods/GoodsclassLists.php index 6bb156c..ea05bfb 100644 --- a/app/api/lists/goods/GoodsclassLists.php +++ b/app/api/lists/goods/GoodsclassLists.php @@ -46,12 +46,14 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface if($pid==0){ $lists = Goodsclass::where($this->searchWhere) ->where('pid', 0) + ->where('children','<>',null) ->field(['id', 'pid', 'name', 'data', 'pic', 'sort']) ->limit($this->limitOffset, $this->limitLength) ->order(['sort' => 'desc','id' => 'desc']) ->select()->toArray(); }else{ $lists = Goodsclass::where($this->searchWhere) + ->where('children','<>',null) ->field(['id', 'pid', 'name', 'data', 'pic', 'sort']) ->limit($this->limitOffset, $this->limitLength) ->order(['sort' => 'desc','id' => 'desc']) @@ -82,9 +84,11 @@ class GoodsclassLists extends BaseAdminDataLists implements ListsSearchInterface $pid=Request()->get('pid',0); if($pid==0){ return Goodsclass::where($this->searchWhere)->where('pid', 0) + ->where('children','<>',null) ->count(); }else{ return Goodsclass::where($this->searchWhere) + ->where('children','<>',null) ->count(); }