完善模型管理

This commit is contained in:
2017-06-19 13:59:36 +08:00
parent 250f6ea95d
commit e3b690efc2
12 changed files with 71 additions and 49 deletions

View File

@@ -58,20 +58,21 @@ class Content extends Fornt {
}
$cate = $this->getCategory($id);
if ($this->modelInfo['extend'] == 1) {
//获得当前栏目的所有子栏目
$map = array();
$attr = db('Attribute')->where('model_id', $this->modelInfo['id'])->column('name');
if (in_array('category_id', $attr)) {
$ids = get_category_child($id);
$map['category_id'] = array('IN', $ids);
$map['model_id'] = $this->modelInfo['id'];
}
if (in_array('status', $attr)) {
$map['status'] = array('GT', 0);
}
if ($this->modelInfo['extend'] > 1) {
$order = "id desc";
} else {
if (in_array('is_top', $attr)) {
$order = "is_top desc,id desc";
}else{
$order = "id desc";
}
$list = $this->model->where($map)->order($order)->paginate(15);
$data = array(