params[ 'pid' ]) ? $this->params[ 'pid' ] : 0;// 上级id $level = isset($this->params[ 'level' ]) ? $this->params[ 'level' ] : 0;// 层级 $goods_category_model = new GoodscategoryModel(); if (!empty($level)) { $condition[] = [ 'level', '=', $level ]; } if (!empty($pid)) { $condition[] = [ 'pid', '=', $pid ]; } $list = $goods_category_list = $goods_category_model->getCategoryByParent($condition, 'category_id,category_name,pid,level,category_id_1,category_id_2,category_id_3'); return $this->response($list); } }