edit-api-customer
This commit is contained in:
@@ -44,29 +44,21 @@ class Customers extends Wxapp
|
||||
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
|
||||
}
|
||||
$admin = $this->app_user_model->get(['id' => $row['admin_id']], 'id,uname');
|
||||
//$brand = $this->auto_brand_model->get(['id' => $row['brand_id']], 'name');
|
||||
//$series = $this->auto_series_model->get(['id' => $row['s_id']], 'name');
|
||||
//$car_json = json_decode($row['car_json'], true);
|
||||
//$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
|
||||
//$version = isset($car_json['version']) ? $car_json['version']['title'] : '';
|
||||
$tags = [$row['level'] . '级用户'];
|
||||
$status_name = $this->customers_model->get_status();
|
||||
$tip = $status_name[$row['status']] ? $status_name[$row['status']] : '';
|
||||
|
||||
$other_data = [
|
||||
//'品牌车型' => $brand['name'] . $series['name'],
|
||||
//'颜色型号' => $color . '-' . $version,
|
||||
'建卡时间' => date('Y-m-d', $row['c_time']),
|
||||
'客户等级' => $row['level'],
|
||||
'客户来源' => $this->get_cfTitle($row),
|
||||
'销售顾问' => isset($admin) ? $admin['uname'] : '',
|
||||
'建卡时间' => date('Y-m-d', $row['c_time']),
|
||||
];
|
||||
$row['cont_time'] != '0000-00-00 00:00:00' && $other_data['最近联系'] = date('Y-m-d', strtotime($row['cont_time']));
|
||||
$other_data['销售顾问'] = isset($admin) ? $admin['uname'] : '';
|
||||
$row['cont_time'] != '0000-00-00 00:00:00' && $other_data['上次联系'] = date('Y-m-d', strtotime($row['cont_time']));
|
||||
$other_data['客户等级'] = $row['level'];
|
||||
$data = [
|
||||
'id' => $row['id'],
|
||||
'name' => $row['name'],
|
||||
'mobile' => $this->get_mobile(['mobile' => $row['mobile'], 'cf_title' => $row['cf_title']]),
|
||||
'mobile' => $this->get_mobile(['mobile' => $row['mobile'], 'of_id' => $row['of_id'],'of2_id'=>$row['of2_id']]),
|
||||
'complete_mobile' => $row['mobile'],
|
||||
'tip' => $tip,
|
||||
'is_top' => $row['is_top'],
|
||||
@@ -92,15 +84,10 @@ class Customers extends Wxapp
|
||||
if (!$row) {
|
||||
throw new Exception('数据不存在', ERR_PARAMS_ERROR);
|
||||
}
|
||||
//$car_json = json_decode($row['car_json'], true);
|
||||
$of_title = $row['of_id'] ? $this->get_cfTitle($row) : '';
|
||||
$data['baseinfo'] = [
|
||||
'name' => ['value' => $row['name'], 'cn' => '客户姓名'],
|
||||
'mobile' => ['value' => $this->get_mobile(['mobile' => $row['mobile'], 'cf_title' => $row['cf_title']]), 'cn' => '客户电话'],
|
||||
//'brand_id' => ['value' => intval($row['brand_id']), 'cn' => '车辆品牌'],
|
||||
//'car_id' => ['value' => intval($row['s_id']), 'cn' => '车辆车系'],
|
||||
//'v_id' => ['value' => intval($row['v_id']), 'cn' => '车型级别'],
|
||||
//'color_id' => ['value' => intval($car_json['c_id']), 'cn' => '车型颜色'],
|
||||
'mobile' => ['value' => $this->get_mobile(['mobile' => $row['mobile'], 'of_id' => $row['of_id'],'of2_id'=>$row['of2_id']]), 'cn' => '客户电话'],
|
||||
'of_id' => ['value' => $of_title, 'of_id' => intval($row['of_id']), 'of2_id' => intval($row['of2_id']), 'cn' => '线索来源'],
|
||||
'buy_time' => ['value' => $row['buy_time'], 'cn' => '预计购车时间'],
|
||||
];
|
||||
@@ -593,28 +580,14 @@ class Customers extends Wxapp
|
||||
$admins = $this->app_user_model->map('id', '', $where, '', '', '', 'id,uname');
|
||||
}
|
||||
|
||||
//品牌车型
|
||||
//$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
//$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//车系车型
|
||||
//$series_arr = array_unique(array_column($rows, 's_id'));
|
||||
//$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
$allot = $this->get_allot();
|
||||
foreach ($rows as $key => $val) {
|
||||
//$car_json = json_decode($val['car_json'], true);
|
||||
//$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
|
||||
//$version = isset($car_json['version']) ? $car_json['version']['title'] : '';
|
||||
|
||||
//$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
//$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
$other_data = [
|
||||
//'品牌车型' => $brand_name . $serie_name,
|
||||
//'颜色型号' => $color . '-' . $version,
|
||||
'建卡时间' => date('Y-m-d', $val['c_time']),
|
||||
'客户来源' => $this->get_cfTitle($val),
|
||||
'销售顾问' => isset($admins[$val['admin_id']]) ? $admins[$val['admin_id']][0]['uname'] : '',
|
||||
'建卡时间' => date('Y-m-d', $val['c_time']),
|
||||
];
|
||||
$val['cont_time'] != '0000-00-00 00:00:00' && $other_data['上次联系'] = date('Y-m-d', strtotime($val['cont_time']));
|
||||
$other_data['销售顾问'] = isset($admins[$val['admin_id']]) ? $admins[$val['admin_id']][0]['uname'] : '';
|
||||
$tags = [$val['level'] . '级用户'];
|
||||
$defeat = '';
|
||||
if ($val['if_defeat'] == 1) {
|
||||
@@ -625,7 +598,7 @@ class Customers extends Wxapp
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'cf_title' => $val['cf_title']]),
|
||||
'mobile' => $this->get_mobile(['mobile' => $val['mobile'],'of_id' => $val['of_id'],'of2_id'=>$val['of2_id']]),
|
||||
'complete_mobile' => $val['mobile'],
|
||||
'is_top' => $val['is_top'],
|
||||
'other_data' => $other_data,
|
||||
@@ -703,7 +676,7 @@ class Customers extends Wxapp
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
$fileds = 'a.id,a.name,a.admin_id,a.mobile,a.level,a.car_json,a.is_top,a.cf_title,a.brand_id,a.s_id
|
||||
,a.cont_time,a.c_time,a.if_defeat';
|
||||
,a.cont_time,a.c_time,a.if_defeat,a.of_id,a.of2_id';
|
||||
$rows = $this->mdCustomersVisit->select_visit($where, 'a.id desc', $page, $size, $fileds);
|
||||
//获取管理员
|
||||
$admin_arr = array_unique(array_column($rows, 'admin_id'));
|
||||
@@ -712,21 +685,8 @@ class Customers extends Wxapp
|
||||
if ($admin_ids) {
|
||||
$admins = $this->app_user_model->map('id', '', ["id in ({$admin_ids})" => null], '', '', '', 'id,uname');
|
||||
}
|
||||
//品牌车型
|
||||
//$brand_arr = array_unique(array_column($rows, 'brand_id'));
|
||||
//$brands = $this->auto_brand_model->get_map_by_ids($brand_arr, 'id,name');
|
||||
//车系车型
|
||||
//$series_arr = array_unique(array_column($rows, 's_id'));
|
||||
//$series = $this->auto_series_model->get_map_by_ids($series_arr, 'id,name');
|
||||
foreach ($rows as $key => $val) {
|
||||
//$car_json = json_decode($val['car_json'], true);
|
||||
//$color = isset($car_json['color']) ? $car_json['color']['title'] : '';
|
||||
//$version = isset($car_json['version']) ? $car_json['version']['title'] : '';
|
||||
//$brand_name = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
|
||||
//$serie_name = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
|
||||
$other_data = [
|
||||
//'品牌车型' => $brand_name . $serie_name,
|
||||
//'颜色型号' => $color . '-' . $version,
|
||||
'建卡时间' => date('Y-m-d', $val['c_time']),
|
||||
'客户来源' => $val['cf_title'],
|
||||
'销售顾问' => isset($admins[$val['admin_id']]) ? $admins[$val['admin_id']][0]['uname'] : '',
|
||||
@@ -742,7 +702,7 @@ class Customers extends Wxapp
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'cf_title' => $val['cf_title']]),
|
||||
'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'of_id' => $val['of_id'],'of2_id'=>$val['of2_id']]),
|
||||
'complete_mobile' => $val['mobile'],
|
||||
'is_top' => $val['is_top'],
|
||||
'other_data' => $other_data,
|
||||
@@ -781,7 +741,7 @@ class Customers extends Wxapp
|
||||
$count = $this->customers_model->count($where);
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
$fileds = 'id,name,mobile,jsondata,cf_title';
|
||||
$fileds = 'id,name,mobile,jsondata,cf_title,of_id,of2_id';
|
||||
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
|
||||
foreach ($rows as $key => $val) {
|
||||
$jsondata = $val['jsondata'] ? json_decode($val['jsondata'], true) : array();
|
||||
@@ -789,7 +749,7 @@ class Customers extends Wxapp
|
||||
$lists[] = [
|
||||
'id' => $val['id'],
|
||||
'name' => $val['name'],
|
||||
'mobile' => $this->get_mobile(['mobile' => $val['mobile'], 'cf_title' => $val['cf_title']]),
|
||||
'mobile' => $this->get_mobile(['mobile' => $val['mobile'],'of_id' => $val['of_id'],'of2_id'=>$val['of2_id']]),
|
||||
'reason' => $reason,
|
||||
];
|
||||
}
|
||||
@@ -887,14 +847,17 @@ class Customers extends Wxapp
|
||||
if (!$mobile) {
|
||||
return '';
|
||||
}
|
||||
$group_id = $this->session['group_id'];
|
||||
if ($params['cf_title'] == '自有资源' && ($group_id == 2 || $group_id == 3)) {//2店长,3老板显示全部电话
|
||||
return $mobile;
|
||||
}
|
||||
if ($params['type'] == 1) {
|
||||
// $group_id = $this->session['group_id'];
|
||||
// if ($params['cf_title'] == '自有资源' && ($group_id == 2 || $group_id == 3)) {//2店长,3老板显示全部电话
|
||||
// return $mobile;
|
||||
// }
|
||||
// if ($params['type'] == 1) {
|
||||
// $mobile = '****' . substr($mobile, -4);
|
||||
// } else {
|
||||
// $mobile = mobile_asterisk($mobile);
|
||||
// }
|
||||
if($params['of2_id']==37 && $params['of_id']==3){ //客户来源:网络推广-狸车分配 隐藏手机号
|
||||
$mobile = '****' . substr($mobile, -4);
|
||||
} else {
|
||||
$mobile = mobile_asterisk($mobile);
|
||||
}
|
||||
return $mobile;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user