quickSearch() ->field(['*']) ->catchOrder() ->articlesCount() ->select()->toTree(); } /** * 是否存在下级 * * @time 2021年03月03日 * @param int $id * @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DbException * @throws \think\db\exception\ModelNotFoundException * @return array|\think\Model|null */ public function hasNextLevel($id = 0) { return $this->where('parent_id', $id ? :$this->getKey())->find(); } }