diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php
index 92e6b5ac..5f5e733f 100644
--- a/admin/controllers/receiver/Clues.php
+++ b/admin/controllers/receiver/Clues.php
@@ -235,13 +235,13 @@ class Clues extends HD_Controller
}
//获取分销用户
$cf_user = '';
- if($dataInfo['recommend_id']){
+ if ($dataInfo['recommend_id']) {
$this->load->model('app/liche/app_liche_users_model');
- $user = $this->app_liche_users_model->get(['id'=>$dataInfo['recommend_id']],'id,nickname,up_uid');
- $user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id'=>$user['up_uid']],'id,nickname'); //上一级分销用户
- if($up_user){
+ $user = $this->app_liche_users_model->get(['id' => $dataInfo['recommend_id']], 'id,nickname,up_uid');
+ $user['up_uid'] && $up_user = $this->app_liche_users_model->get(['id' => $user['up_uid']], 'id,nickname'); //上一级分销用户
+ if ($up_user) {
$cf_user = "{$up_user['nickname']}(一级) => {$user['nickname']}(二级)";
- }else{
+ } else {
$cf_user = $user['nickname'];
}
}
@@ -341,7 +341,7 @@ class Clues extends HD_Controller
if (!mobile_valid($info['mobile'])) {
return $this->show_json(SYS_CODE_FAIL, '手机号码不准确');
}
- if($this->clues_model->get(['mobile'=>$info['mobile']])){
+ if ($this->clues_model->get(['mobile' => $info['mobile']])) {
return $this->show_json(SYS_CODE_FAIL, '手机号已存在');
}
$cf_id = 0;
@@ -601,7 +601,7 @@ class Clues extends HD_Controller
foreach ($ids_arr as $val) {
$clues_row = $clues_rows[$val][0];
//判断是否已分配
- $cus_row = $this->customers_model->get(['rid' => $val,'status>='=>0]);
+ $cus_row = $this->customers_model->get(['rid' => $val, 'status>=' => 0]);
if ($clues_row && !$cus_row) {
$jsondata = json_decode($clues_row['jsondata'], true);
$add_data = [
@@ -615,6 +615,8 @@ class Clues extends HD_Controller
's_id' => $clues_row['s_id'],
'if_driver' => $clues_row['if_driver'],
'cf_title' => '平台分配',
+ 'of_id' => 3,
+ 'of2_id' => 37,
'cf_id' => $clues_row['cf_id'],
'p_time' => date('Y-m-d H:i:s'),
'c_time' => $clues_row['en_time'] == '0000-00-00 00:00:00' ? $clues_row['c_time'] : strtotime($clues_row['en_time'])
@@ -813,7 +815,7 @@ class Clues extends HD_Controller
$fails[] = array('data' => $v, 'msg' => 'mobile valid fail');
continue;
}
- if($this->clues_model->get(['mobile'=>$v['mobile']])){
+ if ($this->clues_model->get(['mobile' => $v['mobile']])) {
$fails[] = array('data' => $v, 'msg' => '手机号已存在');
continue;
}
diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php
index 39f516b3..24755f86 100644
--- a/admin/controllers/receiver/Customer.php
+++ b/admin/controllers/receiver/Customer.php
@@ -161,31 +161,12 @@ class Customer extends HD_Controller
$order_time[0] && $where["order_time >="] = $order_time[0] . ' 00:00:00';
$order_time[1] && $where["order_time <="] = $order_time[1] . ' 23:59:59';
}
- if ($params['cfrom_id'] || $params['cfrom_id2']) {
- if ($params['cfrom_id'] == 24) {
- $where['cf_id'] = 24;
- $params['cfrom_id2'] && $where['t_id'] = $params['cfrom_id2'];
- } else {
- if ($params['cfrom_id2']) {
- $where['cf_id'] = $params['cfrom_id2'];
- } else {
- $cf_rows = $this->clues_cfrom_model->select(['pid' => $params['cfrom_id']], '', '', '', 'id');
- $cf_ids = array_column($cf_rows, 'id');
- $cf_ids[] = $params['cfrom_id'];
- $cf_str_ids = implode(',', array_filter($cf_ids));
- $cf_str_ids && $where["cf_id in ({$cf_str_ids})"] = null;
- }
- }
- }
$count = $this->customers_model->count($where);
$lists = [];
$offlineSources = $this->customers_model->offlineSources();
if ($count) {
- $fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,cf_id,level,of_id,of2_id';
+ $fileds = 'id,name,mobile,cf_title,cf_clues,cont_time,admin_id,status,biz_id,level,of_id,of2_id';
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
- //获取来源
- $cf_id_arr = array_unique(array_column($rows, 'cf_id'));
- $cf_rows = $this->clues_cfrom_model->get_map_by_ids($cf_id_arr, 'id,title');
//获取销售员
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
$admin_id_arr && $admin_rows = $this->app_licheb_users_model->get_map_by_ids($admin_id_arr, 'id,uname');
@@ -212,7 +193,6 @@ class Customer extends HD_Controller
'level' => $val['level'],
'cf_title' => $val['cf_title'],
'of_title' => $of_title,
- 'cf_name' => isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '',
'status_name' => $status_arr[$val['status']],
'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'] : '',
@@ -268,7 +248,6 @@ class Customer extends HD_Controller
} else {
$mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : '';
}
- $cf_row = $this->clues_cfrom_model->get(['id' => $row['cf_id']], 'id,title');
//获取分销用户
$cf_user = '';
$clues = $this->clues_model->get(['id' => $row['rid']], 'recommend_id');
@@ -293,8 +272,6 @@ class Customer extends HD_Controller
'id' => $row['id'],
'name' => $row['name'],
'mobile' => $mobile_sub,
- 'cf_title' => $row['cf_title'],
- 'cf_name' => $cf_row['title'],
'of_title' => $of_title,
'cf_user' => $cf_user,
'c_time' => date('Y-m-d H:i:s', $row['c_time']),
diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php
index a183cff4..8dfe6372 100644
--- a/admin/views/receiver/customer/get.php
+++ b/admin/views/receiver/customer/get.php
@@ -50,22 +50,19 @@
| 客户姓名: |
|
+ style="width: 200px;">
客户电话:{{info.mobile}} |
- 渠道来源:{{info.cf_title}} |
加入时间:{{info.c_time}} |
| 线下来源:{{info.of_title}} |
- 线上来源:{{info.cf_name}} |
分销来源:{{info.cf_user}}
|
-
- |
+ |
|
diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php
index a418521a..bc538c38 100644
--- a/admin/views/receiver/customer/lists.php
+++ b/admin/views/receiver/customer/lists.php
@@ -62,41 +62,6 @@
-
-
-
+
|
- |
+ |
@@ -297,10 +275,6 @@
searchTpAry: [],
lists: [],
qdjl_lists: [],
- cfrom_id:=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
- cfrom_id2:=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
- cfroms: [],
- cfroms2: [],
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
show_info: {levelAry: [], offlineSourcesAry: []},
of2Ary: [],
@@ -312,22 +286,9 @@
vm.lists = =json_encode($lists)?>;
vm.qdjl_lists = =json_encode($qdjl_lists)?>;
vm.show_info = =json_encode($show_info)?>;
- this.getCfroms();
vm.init_citys();
},
methods: {
- getCfroms: function () {
- var that = this
- $.get('/receiver/clues/get_cfroms', function (result) {
- that.cfroms = result.data.data
- });
- if (that.cfrom_id > 0) {
- var url = that.cfrom_id == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
- $.get(url, {'id': that.cfrom_id}, function (result) {
- that.cfroms2 = result.data.data
- });
- }
- },
btnTimes: function () {
layer.open({
type: 1,
@@ -410,29 +371,6 @@
that.of2Ary = that.show_info.offlineSourcesAry[nv]['list'];
}
},
- 'cfrom_id': function (nv, ov) {
- var that = this;
- if (nv == '') {
- that.cfrom_id2 = 0;
- that.cfroms = [];
- } else {
- var url = nv == 24 ? '/common/material' : '/receiver/clues/get_cfroms';
- $.get(url, {'id': nv}, function (result) {
- that.cfroms2 = result.data.data;
- if (that.cfrom_id2 > 0) {
- var cfrom_id2 = '0';
- for (var i in that.cfroms) {
- var county = that.cfroms[i];
- if (county.id == that.cfrom_id2) {
- cfrom_id2 = county.id;
- break;
- }
- }
- that.cfrom_id2 = cfrom_id2;
- }
- });
- }
- },
'params.city_id_admin': function (nv, ov) {
var that = this;
if (nv == '') {
diff --git a/api/controllers/plan/Temp.php b/api/controllers/plan/Temp.php
index 7e909350..9e8fb04e 100644
--- a/api/controllers/plan/Temp.php
+++ b/api/controllers/plan/Temp.php
@@ -152,14 +152,19 @@ class Temp extends HD_Controller
{
$this->load->model('receiver/receiver_customers_model', 'mdCustomers');
$param = $this->input->get();
+ if ($param['up_id']) {
+ $ret = $this->mdCustomers->update(['of_id' => 3, 'of2_id' => 37], ['id' => $param['up_id']]);
+ echo $ret ? ' 更新成功:' : ' 更新失败:';
+ exit;
+ }
$param['page'] = intval($param['page']);
$param['size'] = intval($param['size']);
!$param['size'] && $param['size'] = 50;
!$param['page'] && $param['page'] = 1;
$counts = intval($param['counts']);
ob_start(); //打开缓冲区
- $where = array("cf_title" => '素材推广');
- $res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,cf_title');
+ $where = array("cf_id" => 29);
+ $res = $this->mdCustomers->select($where, 'id ASC', $param['page'], $param['size'], 'id,of_id');
if (!$res) {
echo ' 本次更新客户线下来源完成了:';
echo ' 成功更新 ' . $counts . ' 条';
@@ -168,9 +173,11 @@ class Temp extends HD_Controller
}
$log = array();
foreach ($res as $key => $value) {
- $this->mdCustomers->update(['cf_title' => '自有资源', 'of_id' => 5, 'of2_id' => 53], ['id' => $value['id']]);
- $log[] = array('id' => $value['id'], 'of_id' => 5);
- $counts++;
+ if (!$value['of_id']) {
+ $this->mdCustomers->update(['of_id' => 5, 'of2_id' => 53], ['id' => $value['id']]);
+ $log[] = array('id' => $value['id'], 'of_id' => 5);
+ $counts++;
+ }
}
echo ' 成功更新:';
$log && print_r($log);
diff --git a/api/controllers/wxapp/material/Biz.php b/api/controllers/wxapp/material/Biz.php
index 6e60a689..84ccf60b 100644
--- a/api/controllers/wxapp/material/Biz.php
+++ b/api/controllers/wxapp/material/Biz.php
@@ -196,13 +196,10 @@ class Biz extends Wxapp
if (!$re_biz) {
return $this->Hd_exception(SYS_CODE_FAIL, '预约的门店不存在!');
}
- $of_id = $of2_id = 0;
if ($type == 'biz') {
$cf_id = 29;
} else {
$cf_id = $this->cf_id;
- $of_id = 5;
- $of2_id = 53;//狸车素材
}
$add_data = [
'name' => $this->session['uname'] ? $this->session['uname'] : '',
@@ -211,13 +208,13 @@ class Biz extends Wxapp
'city_id' => $re_biz['city_id'],
'county_id' => $re_biz['county_id'],
'cf_title' => '自有资源',
+ 'of_id' => 5,
+ 'of2_id' => 53,
'cf_id' => $cf_id,
't_id' => $t_id,
'p_time' => date('Y-m-d H:i:s'),
'c_time' => time()
];
- $of_id && $add_data['of_id'] = $of_id;
- $of2_id && $add_data['of2_id'] = $of2_id;
$where = ['biz_id' => $biz_id, 'mobile' => $add_data['mobile']];
$re_cus = $this->mdCustomers->get($where);
if ($re_cus) {
diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php
index 3a711f77..b11d22b6 100644
--- a/common/models/receiver/Receiver_customers_model.php
+++ b/common/models/receiver/Receiver_customers_model.php
@@ -82,7 +82,7 @@ class Receiver_customers_model extends HD_Model
$arr[2] = ['name' => '转介绍', 'list' => [20 => '其他4S店', 21 => '其他二网', 22 => '汽车美容', 23 => '二手车',
24 => '修车厂', 25 => '驾校', 26 => '老车主', 27 => '亲朋好友']];
$arr[3] = ['name' => '网络推广', 'list' => [30 => '抖音', 31 => '区域媒体', 32 => '懂车帝', 33 => '易车',
- 34 => '汽车之家', 35 => '网红', 36 => '厂商分配']];
+ 34 => '汽车之家', 35 => '网红', 36 => '厂商分配', 37 => '狸车分配']];
$arr[4] = ['name' => '外展外拓', 'list' => [40 => '巡展', 41 => '车展', 42 => '静展', 43 => '大客户']];
$arr[5] = ['name' => '自媒体', 'list' => [50 => '小红书号', 51 => '咸鱼号', 52 => '抖音号', 53 => '狸车素材', 54 => '知乎号']];
if ($id) {
|