diff --git a/admin/controllers/auto/Attr.php b/admin/controllers/auto/Attr.php index f9285755..452065eb 100644 --- a/admin/controllers/auto/Attr.php +++ b/admin/controllers/auto/Attr.php @@ -46,11 +46,23 @@ class Attr extends HD_Controller $where['s_id'] = -1; } } + strlen($params['type']) && $where['type'] = $params['type']; + if (!strlen($params['status'])){ + $params['status'] = $where['status'] = 1; + } + elseif ($params['status'] == -9){ + # pass + } + else{ + $where['status'] = $params['status']; + } + !$params['s_id'] && $params['s_id'] = ''; !$params['brand_id'] && $params['brand_id'] = ''; + !strlen($params['type']) && $params['type'] = ''; $count = $this->auto_attr_model->count($where); - $rows = $this->auto_attr_model->select($where, 'id desc', $page, $size); + $rows = $this->auto_attr_model->select($where, 'id desc', $page, $size, '*, (select brand_id from lc_auto_series where id=lc_auto_attr.s_id) as brand_id'); $type_arr = $this->auto_attr_model->get_type(); $status_arr = $this->auto_brand_model->get_status(); @@ -66,6 +78,7 @@ class Attr extends HD_Controller $list[] = [ 'id' => $val['id'], 'title' => $val['title'], + 'brand_name' => $map_brand[$val['brand_id']] ? $map_brand[$val['brand_id']] : '', 's_name' => $series_rows[$val['s_id']] ? $series_rows[$val['s_id']][0]['name'] : '', 'status_name' => $status_arr[$val['status']], 'status' => $val['status'], @@ -74,6 +87,10 @@ class Attr extends HD_Controller ]; } } + $status_arr_list = $status_arr; + unset($status_arr_list[-1]); + $this->data['status_arr'] = $status_arr_list; + $this->data['type_arr'] = $type_arr; $this->data['lists'] = $list; $this->data['params'] = $params; $this->data['brandAry'] = $map_brand; diff --git a/admin/controllers/auto/Brand.php b/admin/controllers/auto/Brand.php index 9919fa56..bbf1d6e7 100644 --- a/admin/controllers/auto/Brand.php +++ b/admin/controllers/auto/Brand.php @@ -27,6 +27,16 @@ class Brand extends HD_Controller{ $size = 20; $where["status > -1"] = null; $params['title'] && $where["name like '%{$params['title']}%'"] = null; + if (!strlen($params['status'])){ + $params['status'] = $where['status'] = 1; + } + elseif ($params['status'] == -9){ + # pass + } + else{ + $where['status'] = $params['status']; + } + $count = $this->auto_brand_model->count($where); $rows = $this->auto_brand_model->select($where, 'id desc', $page, $size); $status_arr = $this->auto_brand_model->get_status(); @@ -43,6 +53,9 @@ class Brand extends HD_Controller{ ]; } } + $status_arr_list = $status_arr; + unset($status_arr_list[-1]); + $this->data['status_arr'] = $status_arr_list; $this->data['lists'] = $list; $this->data['params'] = $params; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); @@ -129,6 +142,20 @@ class Brand extends HD_Controller{ $stauts = $this->input->post('status'); $where = array('id' => $id); $this->auto_brand_model->update(array('status' => $stauts), $where); + if ($stauts == -1){ + $this->load->model('auto/auto_cars_model'); + $this->load->model('auto/auto_series_model'); + $this->load->model('auto/auto_attr_model'); + # 车型库 + $this->auto_cars_model->update(array('status' => $stauts), array('brand_id' => $id)); + # 车系 + $this->auto_series_model->update(array('status' => $stauts), array('brand_id' => $id)); + # 车辆属性 + $this->auto_attr_model->update(array('status' => $stauts), array("s_id in (select id from lc_auto_series where brand_id = {$id})" => null)); + # 车型介绍 + $this->load->model('auto/auto_introduce_model', 'mdAutoIntroduce'); + $this->mdAutoIntroduce->update(array('status' => $stauts), array('brand_id' => $id)); + } return $this->show_json(SYS_CODE_SUCCESS, '操作成功'); } diff --git a/admin/controllers/auto/Series.php b/admin/controllers/auto/Series.php index 670617ec..7dc305f6 100644 --- a/admin/controllers/auto/Series.php +++ b/admin/controllers/auto/Series.php @@ -31,6 +31,16 @@ class Series extends HD_Controller{ } else { $params['brand_id'] = ''; } + if (!strlen($params['status'])){ + $params['status'] = $where['status'] = 1; + } + elseif ($params['status'] == -9){ + # pass + } + else{ + $where['status'] = $params['status']; + } + $count = $this->auto_series_model->count($where); $rows = $this->auto_series_model->select($where, 'id desc', $page, $size); $status_arr = $this->auto_series_model->get_status(); @@ -53,6 +63,9 @@ class Series extends HD_Controller{ ]; } } + $status_arr_list = $status_arr; + unset($status_arr_list[-1]); + $this->data['status_arr'] = $status_arr_list; $this->data['lists'] = $list; $this->data['params'] = $params; $this->data['brandAry'] = $map_brand; diff --git a/admin/views/auto/attr/lists.php b/admin/views/auto/attr/lists.php index fe452af4..29e149c2 100755 --- a/admin/views/auto/attr/lists.php +++ b/admin/views/auto/attr/lists.php @@ -8,7 +8,7 @@