From aba90a66f8777cca919db09e65b2429a6ccc175d Mon Sep 17 00:00:00 2001 From: qianhy Date: Tue, 7 Mar 2023 17:16:37 +0800 Subject: [PATCH] brand status about series select, attr select --- admin/controllers/auto/Attr.php | 16 +++++++++++++++- admin/controllers/auto/Business.php | 2 ++ admin/controllers/auto/Cars.php | 5 ++++- admin/controllers/auto/Finance.php | 5 ++++- admin/controllers/auto/Introduce.php | 1 + admin/controllers/auto/Series.php | 11 +++++++++++ admin/controllers/items/Cost.php | 10 ++++++++-- admin/controllers/items/goods/Goods.php | 14 ++++++++++++-- admin/controllers/items/goods/Logs.php | 4 ++-- admin/views/auto/business/get.php | 6 +++--- admin/views/auto/business/lists.php | 4 ++-- admin/views/auto/finance/lists.php | 8 ++++---- admin/views/items/cost/lists.php | 4 ++-- admin/views/items/goods/lists_sold.php | 6 +++--- admin/views/items/logs/lists.php | 6 +++--- 15 files changed, 76 insertions(+), 26 deletions(-) diff --git a/admin/controllers/auto/Attr.php b/admin/controllers/auto/Attr.php index 6f1435dc..6589633a 100644 --- a/admin/controllers/auto/Attr.php +++ b/admin/controllers/auto/Attr.php @@ -216,10 +216,24 @@ class Attr extends HD_Controller $where = array(); $s_id && $where['s_id'] = $s_id; strlen($type) > 0 && $where['type'] = $type; - if ($status == 3) {//搜索专用 + /*if ($status == 3) {//搜索专用 $where['status'] = 1; } else { $where['status>'] = -1; + }*/ + if(strlen($status) > 0){ + if (strpos($status,'>') !== false || strpos($status,'<') !== false || strpos($status,'in') !== false){ + $where["status {$status}"] = null; + } + else{ + if ($status == 3) {//搜索专用 + $where['status'] = 1; + } else { + $where['status>'] = -1; + } + } + } else { + $where['status > -1'] = null; } $where['status>-1'] = null; $total = $this->auto_attr_model->count($where); diff --git a/admin/controllers/auto/Business.php b/admin/controllers/auto/Business.php index 08f49790..085f249e 100644 --- a/admin/controllers/auto/Business.php +++ b/admin/controllers/auto/Business.php @@ -26,6 +26,8 @@ class Business extends HD_Controller{ $where = array(); $where['brand_id in (select id from lc_auto_brand where status = 1)'] = null; + $where['s_id in (select id from lc_auto_series where status = 1)'] = null; + $where['v_id in (select id from lc_auto_attr where status = 1 and type = 1)'] = null; if($params['brand_id']){ $where['brand_id'] = $params['brand_id']; } else{ diff --git a/admin/controllers/auto/Cars.php b/admin/controllers/auto/Cars.php index f3eddca0..580bbed8 100644 --- a/admin/controllers/auto/Cars.php +++ b/admin/controllers/auto/Cars.php @@ -30,6 +30,8 @@ class Cars extends HD_Controller{ $where = array(); $where['brand_id in (select id from lc_auto_brand where status > -1)'] = null; + $where['s_id in (select id from lc_auto_series where status > -1)'] = null; + $where['v_id in (select id from lc_auto_attr where status > -1 and type = 1)'] = null; if($params['brand_id']){ $where['brand_id'] = $params['brand_id']; } else{ @@ -121,7 +123,8 @@ class Cars extends HD_Controller{ //获取品牌map $where_brand = array('status > -1' => null); - $map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name'); + #$map_brand = $this->auto_brand_model->map('id', 'name', $where_brand, 'id desc', 0 , 0, 'id, name'); + $map_brand = $this->auto_brand_model->map_brand_list($this->auto_brand_model->map_brand($where_brand)); //状态 $statusAry = array('0' => '关闭', '1' => '开启'); if($id){ diff --git a/admin/controllers/auto/Finance.php b/admin/controllers/auto/Finance.php index 6b6788cc..3d6e3980 100644 --- a/admin/controllers/auto/Finance.php +++ b/admin/controllers/auto/Finance.php @@ -43,8 +43,11 @@ class Finance extends HD_Controller{ $params['brand_id'] && $where["$t2.brand_id"] = $params['brand_id']; $params['s_id'] && $where["$t2.s_id"] = $params['s_id']; $params['v_id'] && $where["$t2.v_id"] = $params['v_id']; - $params['cor_id'] && $where["$t2.cor_id"] = $params['cor_id']; + #$params['cor_id'] && $where["$t2.cor_id"] = $params['cor_id']; + #$where[$t2.'.color_id in (select id from lc_auto_attr where status = 1 and type = 0)'] = null; $where[$t2.'.brand_id in (select id from lc_auto_brand where status = 1)'] = null; + $where[$t2.'.s_id in (select id from lc_auto_series where status = 1)'] = null; + $where[$t2.'.v_id in (select id from lc_auto_attr where status = 1 and type = 1)'] = null; $total = $this->auto_finance_model->count_finance($where); $lists = array(); diff --git a/admin/controllers/auto/Introduce.php b/admin/controllers/auto/Introduce.php index 1a39f0fc..5650b182 100644 --- a/admin/controllers/auto/Introduce.php +++ b/admin/controllers/auto/Introduce.php @@ -36,6 +36,7 @@ class Introduce extends HD_Controller $where['status'] = $params['status']; } $where['brand_id in (select id from lc_auto_brand where status > -1)'] = null; + $where['s_id in (select id from lc_auto_series where status > -1)'] = null; $count = $this->mdAutoIntroduce->count($where); if ($count) { $res = $this->mdAutoIntroduce->select($where, "id desc", $params['page'], $params['size']); diff --git a/admin/controllers/auto/Series.php b/admin/controllers/auto/Series.php index d747d3a6..87357086 100644 --- a/admin/controllers/auto/Series.php +++ b/admin/controllers/auto/Series.php @@ -81,11 +81,22 @@ class Series extends HD_Controller{ */ public function json_lists(){ $brand_id = $this->input->get_post('brand_id'); + $status = $this->input->get_post('status'); $page = $this->input->get_post('page'); $size = $this->input->get_post('size'); $where = array('status > -1' => null); $brand_id && $where['brand_id'] = $brand_id; + if(strlen($status) > 0){ + if (strpos($status,'>') !== false || strpos($status,'<') !== false || strpos($status,'in') !== false){ + $where["status {$status}"] = null; + } + else{ + $where['status'] = $status; + } + } else { + $where['status > -1'] = null; + } $orderby = 'id desc'; $total = $this->auto_series_model->count($where); diff --git a/admin/controllers/items/Cost.php b/admin/controllers/items/Cost.php index 365e474c..e04e59ba 100644 --- a/admin/controllers/items/Cost.php +++ b/admin/controllers/items/Cost.php @@ -13,8 +13,8 @@ class Cost extends HD_Controller{ $this->load->model('app/licheb/app_licheb_users_model'); $this->load->model('app/liche/app_liche_orders_model'); $this->load->model('sys/sys_company_model'); - $this->load->model('auto/auto_series_model'); $this->load->model('auto/auto_brand_model'); + $this->load->model('auto/auto_series_model'); $this->load->model('auto/auto_attr_model'); $this->load->library('receiver/orders_v2_entity'); } @@ -47,7 +47,7 @@ class Cost extends HD_Controller{ $params['s_id'] = ''; } if ($params['v_id']) {//车型 - $where["v_id"] = $params['v_id']; + //$where["v_id"] = $params['v_id']; $where_items = $where_items." and v_id = ".$params['v_id']; } else { $params['v_id'] = ''; @@ -149,6 +149,12 @@ class Cost extends HD_Controller{ $size = $params['size'] = $params['size'] ? intval($params['size']) : 20; $autoList = array(); $where = $this->get_where($params); + if ($params['brand_id']) { + $autoList[2] = $this->auto_series_model->select(array('status > -1' => null, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); + } + if ($params['s_id']) { + $autoList[3] = $this->auto_attr_model->select(array('status > -1' => null, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); + } $count = $this->items_cost_model->count($where); $lists = []; diff --git a/admin/controllers/items/goods/Goods.php b/admin/controllers/items/goods/Goods.php index ce4708e2..7c140097 100644 --- a/admin/controllers/items/goods/Goods.php +++ b/admin/controllers/items/goods/Goods.php @@ -66,14 +66,24 @@ class Goods extends HD_Controller $where_1['brand_id'] = $params['brand_id']; $where_2['m.brand_id'] = $params['brand_id']; $where_3['m.brand_id'] = $params['brand_id']; - $autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); + if (1 == $params['sold']){ + $autoList[2] = $this->mdAutoSeries->select(array('status > -1' => null, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); + } + else{ + $autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); + } } if ($params['s_id']) { $where['s_id'] = $params['s_id']; $where_1['s_id'] = $params['s_id']; $where_2['m.s_id'] = $params['s_id']; $where_3['m.s_id'] = $params['s_id']; - $autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); + if (1 == $params['sold']){ + $autoList[3] = $this->mdAutoAttr->select(array('status > -1' => null, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); + } + else{ + $autoList[3] = $this->mdAutoAttr->select(array('status' => 1, 'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); + } } if ($params['v_id']) { $where['v_id'] = $params['v_id']; diff --git a/admin/controllers/items/goods/Logs.php b/admin/controllers/items/goods/Logs.php index 7c7a4044..c4dcbc30 100644 --- a/admin/controllers/items/goods/Logs.php +++ b/admin/controllers/items/goods/Logs.php @@ -46,11 +46,11 @@ class Logs extends HD_Controller $where['brand_id in (select id from lc_auto_brand where status > -1)'] = null; if ($params['brand_id']) { $where['brand_id'] = $params['brand_id']; - $autoList[2] = $this->mdAutoSeries->select(array('status' => 1, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); + $autoList[2] = $this->mdAutoSeries->select(array('status > -1' => null, 'brand_id' => $params['brand_id']), 'id desc', 0, 0, 'id,name'); } if ($params['s_id']) { $where['s_id'] = $params['s_id']; - $autoList[3] = $this->mdAutoAttr->select(array('status' => 1,'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); + $autoList[3] = $this->mdAutoAttr->select(array('status > -1' => null,'type' => 1, 's_id' => $params['s_id']), 'id desc', 0, 0, 'id,title as name'); } if ($params['v_id']) { $where['v_id'] = $params['v_id']; diff --git a/admin/views/auto/business/get.php b/admin/views/auto/business/get.php index d94afeb5..38caadff 100644 --- a/admin/views/auto/business/get.php +++ b/admin/views/auto/business/get.php @@ -231,7 +231,7 @@ var vm = this; vm.seryAry = {}; if(nv > 0){ - $.get('/auto/series/json_lists',{brand_id:nv},function (data) { + $.get('/auto/series/json_lists',{brand_id:nv, status:1},function (data) { if (1 == data.code) { var lists = data.data.list; var seryAry = {}; @@ -254,12 +254,12 @@ var old_s_id = ''; if (nv > 0) { //型号 - $.get('/auto/attr/json_lists',{s_id:nv,'status':1,'type':1},function (response) { + $.get('/auto/attr/json_lists',{s_id:nv,'status':3,'type':1},function (response) { if (response.code == 1) { vm.attrvAry = response.data.list; } },'json'); - $.get('/auto/attr/json_lists',{s_id:nv,'status':1,'type':0},function (response) { + $.get('/auto/attr/json_lists',{s_id:nv,'status':3,'type':0},function (response) { if (response.code == 1) { vm.colorattrvAry = response.data.list; if(vm.colors){ diff --git a/admin/views/auto/business/lists.php b/admin/views/auto/business/lists.php index 323c0e40..457b7538 100644 --- a/admin/views/auto/business/lists.php +++ b/admin/views/auto/business/lists.php @@ -265,7 +265,7 @@ url: '/auto/series/json_lists', type: 'post', dataType: 'json', - data: {brand_id:nv}, + data: {brand_id:nv, status:1}, beforeSend: function () {}, success: function (data) { if (1 == data.code) { @@ -300,7 +300,7 @@ dataType: 'json', data: { s_id: nv, - status: 1, + status: 3, type: 1 }, success: function (response) { diff --git a/admin/views/auto/finance/lists.php b/admin/views/auto/finance/lists.php index 7328117d..b8c03fc8 100644 --- a/admin/views/auto/finance/lists.php +++ b/admin/views/auto/finance/lists.php @@ -28,7 +28,7 @@ -
+