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(); }