diff --git a/app/api/model/Content.php b/app/api/model/Content.php index 219ffef..6a021e1 100644 --- a/app/api/model/Content.php +++ b/app/api/model/Content.php @@ -66,11 +66,14 @@ class Content extends CmsCommon $table_name = $this->cms_table.'_'.$module_info['table_name'].'_'.$site_id; $table_base = in_array($module_info['table_name'],config('cms.base_module'))?$module_info['table_name']:''; + //获取内容列表 $_op = Db::name('cms_common')->alias('cms_common'); + if(in_array($table_name,Db::getTables())){ $_op->join("{$table_name} {$table_name}","cms_common.id={$table_name}.common_id",'left'); } + if($table_base!=''){ $table_base = 'cms_'.$table_base; $_op->join("{$table_base} {$table_base}","cms_common.id={$table_base}.common_id",'left'); @@ -96,6 +99,7 @@ class Content extends CmsCommon $_op->where('delete_time is null'); $_op->where('site_id',SITE_ID); + $_op->where('cate_id',$cate_id); $_op->where('template_id',TEMPLATE_ID); //执行分页查询 $page = $this->request->param('page', config('page')); @@ -107,7 +111,7 @@ class Content extends CmsCommon //无分页判断 $_op->page((int)$page, (int)$limit); $data = $_op->select()->toArray(); - + $data = $this->haddle_format_output($data,$field_info); $field_infos = [];