diff --git a/app/admin/controller/Api.php b/app/admin/controller/Api.php index bcc0f5c..cf5a29a 100644 --- a/app/admin/controller/Api.php +++ b/app/admin/controller/Api.php @@ -336,7 +336,7 @@ class Api extends BaseController $content = $log->get_log_list($param); return table_assign(0, '', $content); } - + public function getbytype(){ $type = get_params("type"); $where['type'] = $type; diff --git a/app/api/controller/Common.php b/app/api/controller/Common.php index 0fc38a4..bf62114 100644 --- a/app/api/controller/Common.php +++ b/app/api/controller/Common.php @@ -322,7 +322,12 @@ class Common extends BaseController if ($id==0 && $type==''){ return $this->apiError('参数不能为空,请填写参数'); } - $where[]=['pid','=',$pid]; + if($pid){ + $where[]=['pid','=',$pid]; + }else{ + $where[]=['pid','<>',0]; + } + $where[]=['status','=','normal']; $select=Db::table('fa_category')->where($where)->select(); return $this->apiSuccess('ok',$select); @@ -359,7 +364,11 @@ class Common extends BaseController if ($id==0 && $type==''){ return $this->apiError('参数不能为空,请填写参数'); } - $where[]=['pid','=',$pid]; + if($pid){ + $where[]=['pid','=',$pid]; + }else{ + $where[]=['pid','<>',0]; + } $where[]=['status','=','normal']; $select=Db::table('fa_category')->where($where)->field('id as category_id,name as topic_name,image as pic,pid')->select()->toArray(); foreach ($select as $k=>$v){