1 Commits

Author SHA1 Message Date
lcc bf1d1317f3 修改客户品牌 2024-09-02 17:42:37 +08:00
3 changed files with 40 additions and 7 deletions
+24 -4
View File
@@ -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']) {
+1
View File
@@ -61,6 +61,7 @@
<tr>
<td class="table-td"><span class="mr5">{{info.time_name}}:</span>{{info.p_time}}</td>
<td class="table-td"><span class="mr5">微信好友:</span>{{info.wx_name}}</td>
<td class="table-td"><span class="mr5">重点关注车型:</span>{{info.brand_detail}}</td>
</tr>
<tr>
<td>
+15 -3
View File
@@ -110,6 +110,7 @@ class Customers extends Wxapp
$cfrom_rows = $this->clues_cfrom_model->get(array('id' => $row['of_id']));
$cfrom_rows['type'] == 1 && $edit_status = true;
}
$brand = $this->auto_brand_model->get(['id' => $row['brand_id']]);
$of_title = $row['of_id'] ? $this->get_cfTitle($row) : '';
$data['baseinfo'] = [
'name' => ['value' => $row['name'], 'cn' => '客户姓名'],
@@ -120,6 +121,8 @@ class Customers extends Wxapp
'wxgr' => $row['wxgr'],
'wxgrimg' => $row['wxgrimg'],
'wxgrimg_url' => $row['wxgrimg'] ? build_qiniu_image_url($row['wxgrimg']) : '',
'brand' => ['id' => $row['brand_id'], 'name' => $brand['name']],
'series_id' => $row['series_id'],
];
return $data;
}
@@ -210,6 +213,8 @@ class Customers extends Wxapp
$county_id = $this->input_param('county_id'); //区id
$wxgr = $this->input_param('wxgr'); //是否加个微
$wxgrimg = $this->input_param('wxgrimg'); //个微截图
$brand_id = (int)$this->input_param('brand_id');
$series_id = (int)$this->input_param('series_id');
$row = $this->customers_model->get(['id' => $id]);
if (!$row) {
throw new Exception('参数错误', ERR_PARAMS_ERROR);
@@ -238,6 +243,8 @@ class Customers extends Wxapp
$county_id && $update['county_id'] = $county_id;
$wxgr && $update['wxgr'] = intval($wxgr) ? 1 : 0;
$wxgrimg && $wxgrimg != $row['wxgrimg'] && $update['wxgrimg'] = $wxgrimg;
$brand_id && $update['brand_id'] = $brand_id ?: 0;
$series_id && $update['series_id'] = $series_id ?: 0;
if ($buy_time) {
$update['level'] = $this->customers_entity->cal_level($buy_time);
$update['buy_time'] = $buy_time;
@@ -305,6 +312,9 @@ class Customers extends Wxapp
$county_id = $this->input_param('county_id'); //区id
$wxgr = $this->input_param('wxgr'); //是否加个微
$wxgrimg = $this->input_param('wxgrimg'); //个微截图
$brand_id = $this->input_param('brand_id');
$series_id = $this->input_param('series_id');
$car_id = $this->input_param('car_id');
if (!mobile_valid($mobile)) throw new Exception('请输入正确的手机号码', ERR_PARAMS_ERROR);
if (!$city_id || !$county_id) {
throw new Exception('请选择城市与行政区', API_CODE_FAIL);
@@ -361,6 +371,8 @@ class Customers extends Wxapp
$buy_time && $add_data['buy_time'] = $buy_time;
$of_id && $add_data['of_id'] = $of_id;
$of2_id && $add_data['of2_id'] = $of2_id;
$brand_id && $add_data['brand_id'] = $brand_id;
$series_id && $add_data['series_id'] = $series_id;
$id = $this->customers_model->add($add_data);
if ($id) {
//客户标签
@@ -1067,7 +1079,7 @@ class Customers extends Wxapp
}
//发送短信
$num = $re['mobile'] ? substr($re['mobile'], -4) : 0;
b2m_send_sms($admin['mobile'], '【理车宝】您有一个新的客户需要跟进,手机尾号为'.$num.'。请及时到小程序“理车宝-客户”进行操作,祝您成单!');
b2m_send_sms($admin['mobile'], '【理车宝】您有一个新的客户需要跟进,手机尾号为' . $num . '。请及时到小程序“理车宝-客户”进行操作,祝您成单!');
}
}
throw new Exception('分配成功', API_CODE_SUCCESS);
@@ -1354,9 +1366,9 @@ class Customers extends Wxapp
$mobile = $params['mobile'];
if (!$mobile) {
return '';
} elseif ($params['rid']){
} elseif ($params['rid']) {
return mobile_asterisk($mobile);
}else {
} else {
return $mobile;
}
}