From 16ea57dccf7e532beb1775d9a51e37371edc9dd3 Mon Sep 17 00:00:00 2001 From: xxb Date: Mon, 9 Aug 2021 11:17:26 +0800 Subject: [PATCH] liche update for admin auto cars list batch do --- admin/controllers/auto/Cars.php | 24 +++++++++++++++++++----- admin/views/auto/cars/lists.php | 29 ++++++++++++++++++++++------- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/admin/controllers/auto/Cars.php b/admin/controllers/auto/Cars.php index 7048f87b..88c2b13b 100644 --- a/admin/controllers/auto/Cars.php +++ b/admin/controllers/auto/Cars.php @@ -83,16 +83,18 @@ class Cars extends HD_Controller{ if($attr_ids){ $str_ids = implode(',', $attr_ids); $where_attr = array("id in ({$str_ids})" => null); - $map_attr = $this->auto_attr_model->map('id', 'title', $where_attr, 'id desc', 0 , 0, 'id, title'); + $map_attr = $this->auto_attr_model->map('id', '*', $where_attr, 'id desc', 0 , 0, 'id, title, type'); } + //属性按'车型-车身颜色-内饰颜色'排序 foreach($rows as $v){ $attr_ids = explode('_', $v['attrs']); - $attr_title = ''; + $arr = array(); foreach($attr_ids as $attr_id){ - $attr_title .= $map_attr[$attr_id] . '-'; + $attr = $map_attr[$attr_id]; + $arr[$attr['type']] =$attr['title']; } - $attr_title = trim($attr_title, '-'); + $attr_title = "{$arr[1]}-{$arr[0]}-{$arr[2]}"; $lists[] = array( 'id' => $v['id'], 'brand_name' => $map_brand[$v['brand_id']], @@ -209,6 +211,7 @@ class Cars extends HD_Controller{ 'brand_id' => $brand_id, 's_id' => $s_id, 'attrs' => $attr, + 'status' => 1, 'c_time' => time() ); } @@ -271,10 +274,21 @@ class Cars extends HD_Controller{ function edit_status(){ $id = $this->input->post('id'); + $field = $this->input->post('field'); + $value = $this->input->post('value'); $status = $this->input->post('status'); + if('status' == $field){ + $status = $value; + } + $upd = array('status' => $status); - $where = array('id' => $id); + + if(is_numeric($id)){ + $where = array('id' => $id); + } else { + $where = array("id in ({$id})" => null); + } $ret = $this->auto_cars_model->update($upd, $where); if(!$ret){ diff --git a/admin/views/auto/cars/lists.php b/admin/views/auto/cars/lists.php index b663092f..c8c2f3c5 100644 --- a/admin/views/auto/cars/lists.php +++ b/admin/views/auto/cars/lists.php @@ -41,17 +41,23 @@ - + - + - + @@ -59,10 +65,10 @@ @@ -70,6 +76,15 @@
+ +
+ +
ID + + ID + 品牌 车系车型-车身-内饰车型-车身颜色-内饰颜色 状态 操作
{{v.id}} + + {{v.id}} + {{v.brand_name}} {{v.sery_name}} {{v.attr_title}} 编辑 - 关闭 - 开启 + 关闭 + 开启