From bf1d1317f329f7c98566242f84f758bf634f0a15 Mon Sep 17 00:00:00 2001 From: lcc <1127794702@qq.com> Date: Mon, 2 Sep 2024 17:42:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=A2=E6=88=B7=E5=93=81?= =?UTF-8?q?=E7=89=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- admin/controllers/receiver/Customer.php | 28 ++++++++++++++++++---- admin/views/receiver/customer/get.php | 1 + api/controllers/wxapp/licheb/Customers.php | 18 +++++++++++--- 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 845d28c3..f4068ebc 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -10,7 +10,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); class Customer extends HD_Controller { private $searchTpAry = array('mobile' => '客户手机号', 'cid' => '客户编号'); - private $searchTimeAry = array('p_time' => '派单/建档时间', 'cont_time' => '最后联系时间', 'dt_time' => '首次到店时间', 'order_time' => '下定时间', 'def_time' => '战败时间','c_time' => '创建时间', ); + private $searchTimeAry = array('p_time' => '派单/建档时间', 'cont_time' => '最后联系时间', 'dt_time' => '首次到店时间', 'order_time' => '下定时间', 'def_time' => '战败时间', 'c_time' => '创建时间',); protected $log_dir; @@ -28,6 +28,7 @@ class Customer extends HD_Controller $this->load->model("biz/biz_model"); $this->load->model('area_model'); $this->load->model('auto/auto_brand_model'); + $this->load->model('auto/auto_series_model'); $this->log_dir = 'receiver_' . get_class($this); } @@ -598,7 +599,15 @@ class Customer extends HD_Controller $area = $this->area_model->get(array('province_id' => $row['province_id'])); $poi = "{$area['province_name']}"; } - + $brand_detail = ''; + if ($row['brand_id']) { + $brand = $this->auto_brand_model->get(['id' => $row['brand_id']]); + $brand && $brand_detail = $brand['name']; + } + if ($row['series_id']) { + $series = $this->auto_series_model->get(['id' => $row['series_id']]); + $series && $brand_detail .= '-' . $series['name']; + } $info = array( 'id' => $row['id'], 'name' => $row['name'], @@ -615,6 +624,7 @@ class Customer extends HD_Controller 'poi' => $poi, 'biz' => $row_biz['biz_name'], 'time_name' => $row['clue_id'] ? '派单时间' : '建档时间', + 'brand_detail' => $brand_detail, ); //到店信息 @@ -928,6 +938,7 @@ class Customer extends HD_Controller "biz_name" => "归属门店", "admin_name" => "归属顾问", "wxgr_name" => "加个微", + 'brand_detail' => '重点关注车型' ]; $count = $this->customers_model->count($where); @@ -937,10 +948,12 @@ class Customer extends HD_Controller $status_arr = $this->customers_model->get_status(); unset($status_arr['-1']); if ($count) { - $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, p_time, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_time, c_brand, 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, wxqy, wxgr, (select city_name from lc_area where city_id = lc_receiver_customers.city_id limit 1) as city_name, (select county_name from lc_area where county_id = lc_receiver_customers.county_id limit 1) as county_name"; + $fileds = "id, name, mobile, level, status, cs_biz_id,brand_id,series_id, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, p_time, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_time, c_brand, 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, wxqy, wxgr, (select city_name from lc_area where city_id = lc_receiver_customers.city_id limit 1) as city_name, (select county_name from lc_area where county_id = lc_receiver_customers.county_id limit 1) as county_name"; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); + $brands = $this->auto_brand_model->get_map_by_ids(array_column($rows, 'brand_id')); + $series = $this->auto_series_model->get_map_by_ids(array_column($rows, 'series_id')); foreach ($rows as $key => $val) { - $of_title = ''; + $brand_detail = $of_title = ''; $of_title_1 = $of_title_2 = ''; if ($val['of_id']) { $of_ary = $offlineSources[$val['of_id']]; @@ -949,6 +962,12 @@ class Customer extends HD_Controller $val['of2_id'] && $of_title .= '-' . $of_ary['list'][$val['of2_id']]; $val['of2_id'] && $of_ary['list'][$val['of2_id']] && $of_title_2 = $of_ary['list'][$val['of2_id']]; } + if ($brands[$val['brand_id']]) { + $brand_detail = $brands[$val['brand_id']][0]['name']; + } + if ($brands[$val['brand_id']]) { + $brand_detail .= '-' . $series[$val['series_id']][0]['name']; + } $id = $val['id']; $row = array( 'id' => $id, @@ -969,6 +988,7 @@ class Customer extends HD_Controller 'biz_name' => $val['biz_name'], 'admin_name' => $val['admin_name'], 'wxgr_name' => $this->customers_model->wxgrAry($val['wxgr']), + 'brand_detail' => $brand_detail, ); if ($params['export_tag']) { diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php index 12d89f7f..292f8bf1 100644 --- a/admin/views/receiver/customer/get.php +++ b/admin/views/receiver/customer/get.php @@ -61,6 +61,7 @@