renderSuccess(compact('tree')); } /** * 获取所有行业列表 */ public function getIndustryList() { $list = IndustryModel::getCacheAll(); return $this->renderSuccess(compact('list')); } /** * 获取行业详情 */ public function detail($industry_id) { $industry = IndustryModel::detail($industry_id); if (!$industry) { return $this->renderError('行业不存在'); } return $this->renderSuccess(compact('industry')); } /** * 获取一级行业列表 */ public function getFirstIndustry() { $list = IndustryModel::getFirstIndustry(); return $this->renderSuccess(compact('list')); } /** * 根据上级ID获取子行业 */ public function getSubIndustry($parent_id = 0) { $model = new IndustryModel; $list = $model->where('parent_id', '=', $parent_id)->where('status', '=', 1) ->order(['sort' => 'asc', 'create_time' => 'asc'])->select(); return $this->renderSuccess(compact('list')); } }