diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 2201dbb1..62d3994a 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -51,7 +51,7 @@ class Customer extends HD_Controller $offlineSources = $this->customers_model->offlineSources(); $wxqyAry = $this->customers_model->wxqyAry(); if ($count) { - $fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,level,of_id,of2_id,wxqy'; + $fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,cs_biz_id,level,of_id,of2_id,wxqy'; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); //获取销售员 $admin_id_arr = array_unique(array_column($rows, 'admin_id')); @@ -81,6 +81,7 @@ class Customer extends HD_Controller 'of2_id' => $val['of2_id'], 'status_name' => $status_arr[$val['status']], 'wxqy_name' => $wxqyAry[$val['wxqy']], + 'to_send' => $this->customers_model->csbizidAry($val['cs_biz_id'] ? $val['cs_biz_id'] : 0), 'admin_name' => isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '', 'biz_name' => isset($biz_rows[$val['biz_id']]) ? $biz_rows[$val['biz_id']][0]['biz_name'] : '', 'cont_time' => $val['cont_time'] != '0000-00-00 00:00:00' ? $val['cont_time'] : '', @@ -92,6 +93,7 @@ class Customer extends HD_Controller $show_info['levelAry'] = $this->customers_model->get_sdata('level'); $show_info['offlineSourcesAry'] = $offlineSources; $show_info['wxqyAry'] = $wxqyAry; + $show_info['csbizidAry'] = $this->customers_model->csbizidAry(); $this->data['show_info'] = $show_info; $this->data['lists'] = $lists; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); @@ -107,6 +109,7 @@ class Customer extends HD_Controller private function get_where(&$params){ !$params['biz_id'] && $params['biz_id'] = ''; + !strlen($params['cs_biz_id']) && $params['cs_biz_id'] = ''; !$params['cf_title'] && $params['cf_title'] = ''; !$params['qdjl_id'] && $params['qdjl_id'] = ''; !$params['level'] && $params['level'] = ''; @@ -160,6 +163,7 @@ class Customer extends HD_Controller } else if ($params['city_id_admin']) { $where["biz_id in(select id from lc_biz where city_id={$params['city_id_admin']})"] = null; } + $where[$this->customers_model->csbizidWhere($params['cs_biz_id'])] = null; !$params['city_id_admin'] && $params['city_id_admin'] = ''; !$params['county_id_admin'] && $params['county_id_admin'] = ''; !$params['biz_id_admin'] && $params['biz_id_admin'] = ''; @@ -272,12 +276,13 @@ class Customer extends HD_Controller } $invalid_user_tag = []; $row['status']==3 && $invalid_user_tag = $this->get_tag($row['id'],1); - $to_send = ''; + /*$to_send = ''; if ($row['cs_biz_id'] == -1) { $to_send = '已改派'; } else if ($row['cs_biz_id'] > 0) { $to_send = '接收线索'; - } + }*/ + $to_send = $this->customers_model->csbizidAry($row['cs_biz_id'] ? $row['cs_biz_id'] : 0); $info = array( 'id' => $row['id'], 'name' => $row['name'], @@ -525,7 +530,7 @@ class Customer extends HD_Controller $params = $this->input->get(); $where = $this->get_where($params); - $where["cs_biz_id >= 0"] = null; + #$where["cs_biz_id >= 0"] = null; $page = 1; $size = 10000; @@ -535,7 +540,7 @@ class Customer extends HD_Controller $status_arr = $this->customers_model->get_status(); unset($status_arr['-1']); if ($count) { - $fileds = "id, name, mobile, level, status, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_time, cf_title, cf_id, of_id, of2_id, (SELECT biz_name FROM `lc_biz` where id = `lc_receiver_customers`.biz_id) as biz_name, (SELECT uname FROM `lc_app_licheb_users` where id = `lc_receiver_customers`.admin_id) as admin_name, biz_id, admin_id"; + $fileds = "id, name, mobile, level, status, cs_biz_id, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_time, cf_title, cf_id, of_id, of2_id, (SELECT biz_name FROM `lc_biz` where id = `lc_receiver_customers`.biz_id) as biz_name, (SELECT uname FROM `lc_app_licheb_users` where id = `lc_receiver_customers`.admin_id) as admin_name, biz_id, admin_id"; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); foreach ($rows as $key => $val) { $of_title = ''; @@ -553,6 +558,7 @@ class Customer extends HD_Controller 'mobile' => $val['mobile'], 'level' => $val['level'], 'status_name' => $status_arr[$val['status']], + 'to_send' => $this->customers_model->csbizidAry($val['cs_biz_id'] ? $val['cs_biz_id'] : 0), 'c_time' => $val['c_time'], 'dt_time' => $val['dt_time'], 'order_time' => $val['order_time'], @@ -570,6 +576,7 @@ class Customer extends HD_Controller 'mobile' => '手机', 'level' => '客户等级', 'status_name' => '客户状态', + 'to_send' => '是否改派', 'c_time' => '建档时间', "dt_time" => "到店时间", "order_time" => "下单时间", diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php index 2e46066b..a44fd0c7 100644 --- a/admin/views/receiver/customer/get.php +++ b/admin/views/receiver/customer/get.php @@ -63,7 +63,7 @@