From 260099bac3d30d44e63b35469fc87d5227b23414 Mon Sep 17 00:00:00 2001 From: 1099438829 <1099438829@qq.com> Date: Tue, 6 Apr 2021 16:59:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/index/common.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/app/index/common.php b/app/index/common.php index 7316632..5373168 100644 --- a/app/index/common.php +++ b/app/index/common.php @@ -84,6 +84,30 @@ function get_document_category($x,$field=false){ } } +/** + * @param $cid int 栏目分类 + * @param bool $field + * @return mixed|string + * @throws Exception + * @author 李玉坤 + * @date 2021-04-06 9:43 + */ +function get_document_category_children($cid,$field=false){ + if(!$cid){ + throw new Exception('请指定要获取的栏目分类id!'); + } + $docuemtCategoryChildrendLidst = Db::name('document_category')->where('id','=',$cid)->column(); + if(!$docuemtCategory){ + throw new Exception('分类不存在或已删除!'); + } + if($field){ + return $docuemtCategory[$field]; + } + else{ + return $docuemtCategory; + } +} + /** * 获取一个文章分类-通个分类标识 */