diff --git a/application/admin/controller/Content.php b/application/admin/controller/Content.php index 4f8ed30d..fb3931c1 100644 --- a/application/admin/controller/Content.php +++ b/application/admin/controller/Content.php @@ -269,6 +269,7 @@ class Content extends Admin { if ($this->modelInfo['extend'] == 1) { $category = isset($data['category']) ? $data['category'] : ''; $cate_list = parse_field_bind('category', $category, 0); + $map['model_id'] = $this->model_id; $this->assign('cate_list', $cate_list); } $this->assign($data); diff --git a/application/index/controller/Content.php b/application/index/controller/Content.php index a9c9bb92..fa777e01 100644 --- a/application/index/controller/Content.php +++ b/application/index/controller/Content.php @@ -59,19 +59,20 @@ class Content extends Fornt { $cate = $this->getCategory($id); - //获得当前栏目的所有子栏目 - $ids = get_category_child($id); - $map['category_id'] = array('IN', $ids); - $map['model_id'] = $this->modelInfo['id']; - $map['status'] = array('GT', 0); + if ($this->modelInfo['extend'] == 1) { + //获得当前栏目的所有子栏目 + $ids = get_category_child($id); + $map['category_id'] = array('IN', $ids); + $map['model_id'] = $this->modelInfo['id']; + $map['status'] = array('GT', 0); + } if ($this->modelInfo['extend'] > 1) { $order = "id desc"; } else { $order = "is_top desc,id desc"; } - $model = $this->model; - $list = $model->where($map)->order($order)->paginate(15); + $list = $this->model->where($map)->order($order)->paginate(15); $data = array( 'list' => $list,