diff --git a/admin/controllers/hdcloud/Clues.php b/admin/controllers/hdcloud/Clues.php index 92cb9ff2..a891c85c 100644 --- a/admin/controllers/hdcloud/Clues.php +++ b/admin/controllers/hdcloud/Clues.php @@ -4,7 +4,7 @@ defined('BASEPATH') or exit('No direct script access allowed'); class Clues extends HD_Controller { - private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名', 'void' => 'voId', ); + private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名', 'void' => 'voId' ); private $bizs = array( '350' => array( 'name' => '福建', @@ -36,8 +36,8 @@ class Clues extends HD_Controller ), '100421' => array( 'biz' => '南平绿衡', - 'sa' => '周伟豪', - 'mobile' => '16659478792' + 'sa' => '黄小英', + 'mobile' => '15759156127' ), '100179' => array( 'biz' => '莆田众诚', @@ -127,7 +127,7 @@ class Clues extends HD_Controller ), ) ), - '410' => array( + '450' => array( 'name' => '广西', 'list' => array( '100813' => array( @@ -194,7 +194,7 @@ class Clues extends HD_Controller $statusAry = $this->clues_model->statusAry(); $params = $this->input->get(); - $this->data['pro_id'] = $pro_id = intval($params['pro_id']); + $this->data['province_id'] = $province_id = intval($params['province_id']); $this->data['biz_id'] = $biz_id = intval($params['biz_id']); $page = $params['page'] = $params['page'] ? intval($params['page']) : 1; @@ -217,20 +217,24 @@ class Clues extends HD_Controller strlen($params['status']) && $where["status"] = $params['status']; - $pro_id && $where['pro_id'] = $pro_id; + $province_id && $where['province_id'] = $province_id; $biz_id && $where['biz_id'] = $biz_id; $count = $this->clues_model->count($where); $lists = []; if ($count) { - $fileds = 'id,void, name,mobile,c_time,admin_id,status,status2'; + $fileds = 'id,void, name,mobile,c_time,admin_id,status, province_id, biz_id'; $rows = $this->clues_model->select($where, 'id desc', $page, $size, $fileds); foreach ($rows as $key => $val) { - $status_name = $statusAry[$val['status']]['name']; - $val['status2'] && $status_name .= '‒' . $statusAry[$val['status']]['list'][$val['status2']]; - $val['status_name'] = $status_name; + $val['status_name'] = $statusAry[$val['status']]['name']; + if($val['province_id']){ + $pro = $this->bizs[$val['province_id']]; + $val['pro_name'] = $pro['name']; + $biz = $this->bizs[$val['province_id']]['list'][$val['biz_id']]; + $val['biz_name'] = $biz['biz']; + } $lists[] = $val; } } @@ -324,17 +328,12 @@ class Clues extends HD_Controller } else { $info = array( 'name' => '', - 'mobile' => '', - 'cf_id1' => '', - 'cf_id2' => '', + 'mobile' => '' ); $title = "新增线索"; $action = "add"; } - $where = array('status' => 1, 'pid' => 0); - $select = 'id, title'; - $this->data['info'] = $info; $this->data['action'] = $action; @@ -550,10 +549,10 @@ class Clues extends HD_Controller } public function get_bizs(){ - $pro_id = $this->input->get('pro_id'); + $province_id = $this->input->get('province_id'); - if($pro_id){ - $bizs = $this->bizs[$pro_id]; + if($province_id){ + $bizs = $this->bizs[$province_id]; if($bizs){ foreach ($bizs['list'] as $k => $v){ @@ -580,12 +579,12 @@ class Clues extends HD_Controller public function edit_adviser(){ $id = $this->input->post('id'); - $pro_id = $this->input->post('pro_id'); + $province_id = $this->input->post('province_id'); $biz_id = $this->input->post('biz_id'); $intent = $this->input->post('intent'); $remark = $this->input->post('remark'); - $biz = $this->bizs[$pro_id]['list'][$biz_id]; + $biz = $this->bizs[$province_id]['list'][$biz_id]; if (!$biz) { return $this->show_json(SYS_CODE_FAIL, '请选择分配门店!'); @@ -594,17 +593,24 @@ class Clues extends HD_Controller $clue_row = $this->clues_model->get(['id' => $id]); if ($clue_row) { - if($clue_row['status']){ - return $this->show_json(SYS_CODE_FAIL, '已分配!'); - } +// if($clue_row['status']){ +// return $this->show_json(SYS_CODE_FAIL, '已分配!'); +// } - $result = $this->push_neta($clue_row['name'], $clue_row['mobile'], $pro_id, $biz, $intent, $remark); + $result = $this->push_neta($clue_row['name'], $clue_row['mobile'], $province_id, $biz, $intent, $remark); $json = json_decode($result, true); - if($json['dataInfo']['rtnMessage'] == '处理成功'){ - - $this->clues_model->update(['status' => 1], ['id' => $id]); + if($json['dataInfo'][0]['rtnMessage'] == '处理成功'){ + $update = array( + 'status' => 1, + 'province_id' => $province_id, + 'biz_id' => $biz_id, + 'voId' => $json['dataInfo'][0]['voId'], + 'intentModel' => $intent, + 'jsondata' => json_encode($json), + ); + $this->clues_model->update($update, ['id' => $id]); return $this->show_json(SYS_CODE_SUCCESS, '分配成功!'); } @@ -613,21 +619,6 @@ class Clues extends HD_Controller return $this->show_json(SYS_CODE_FAIL, '分配失败!'); } - private function upload() - { - $config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/'; - $config['allowed_types'] = 'xls|xlsx'; - $config['max_size'] = 5120; - $config['file_name'] = 'receiver_clues' . time() . rand(1, 99999); - $this->load->library('upload', $config); - if (!$this->upload->do_upload('file')) { - return array('code' => SYS_CODE_FAIL, 'message' => $this->upload->display_errors('', '')); - } else { - $data = $this->upload->data(); - return array('code' => SYS_CODE_SUCCESS, 'path' => $data['full_path'], 'file_ext' => $data['file_ext']); - } - } - /** * 批量新增 * @param $lists @@ -655,11 +646,10 @@ class Clues extends HD_Controller $fails[] = array('data' => $v, 'msg' => '手机号已存在'); continue; } - $cf_id = $map_cfrom[$v['cfrom']]; + $adds[] = array( 'name' => $v['name'], 'mobile' => $v['mobile'], - 'cf_id' => $cf_id ? $cf_id : 0, 'c_time' => time(), ); $done++; @@ -707,13 +697,19 @@ class Clues extends HD_Controller return $this->show_json(SYS_CODE_SUCCESS); } - public function push_neta($customerName, $mobile, $pro_id, $biz, $intentModel = '', $remark = '') + public function push_neta($customerName, $mobile, $province_id, $biz, $intentModel = '', $remark = '') { - $voId = $pro_id . date('mdHis') . sprintf("%06d", rand(1,999999)); + $voId = $province_id . date('mdHis') . sprintf("%06d", rand(1,999999)); + + if(in_array($biz['id'], array('100958', '100966', '101077'))){ + $cusSource3 = '023409'; //区域云店 福泉厦 + }else{ + $cusSource3 = '023305'; //本地通 + } $data[] = array( 'voId' => $voId, - 'cusSource3' => '023409', + 'cusSource3' => $cusSource3, 'customerName' => $customerName, 'dealerCode' => $biz['id'], 'fromSystem' => "好店云", @@ -727,8 +723,8 @@ class Clues extends HD_Controller $data = json_encode($data, JSON_UNESCAPED_UNICODE); //测试地址 - $url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue'; - //$url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue'; + //$url = 'https://salespp-sit.hozonauto.com/appservice/app/if/salesclue/createSalesclue'; + $url = 'https://salesapp.hozonauto.com/appservice/app/if/salesclue/createSalesclue'; $ch = curl_init(); curl_setopt($ch, CURLOPT_POST, 1); diff --git a/admin/views/hdcloud/clues/get.php b/admin/views/hdcloud/clues/get.php index 41948e26..91dff66b 100644 --- a/admin/views/hdcloud/clues/get.php +++ b/admin/views/hdcloud/clues/get.php @@ -12,19 +12,6 @@ -
- -
- - -
-
@@ -39,14 +26,11 @@ el: '#edit-form', data: { info:{}, - cfromAry:[], - cfromAry2:[], action:"" }, mounted:function() { var vm = this; vm.info = ; - vm.cfromAry = ; vm.action = ""; }, methods:{ @@ -58,7 +42,7 @@ loading = 1; $.ajax({ - url: "receiver/clues/" + vm.action, + url: "hdcloud/clues/" + vm.action, type: 'post', dataType: 'json', data: { @@ -89,32 +73,6 @@ } }, watch:{ - 'info.cf_id1':function(nv, ov){ - var vm = this; - if(nv > 0){ - $.ajax({ - url: "receiver/clues/json_map_cfrom", - type: 'post', - dataType: 'json', - data: { - pid:vm.info.cf_id1, - status:1 - }, - beforeSend: function () {}, - success: function (data) { - if (1 == data.code) { - vm.cfromAry2 = data.data; - if(undefined == vm.cfromAry2[vm.info.cf_id2]){ - vm.info.cf_id2 = ''; - } - } - } - }); - } else { - vm.cfromAry2 = []; - vm.info.cf_id2 = ''; - } - } } }); }); diff --git a/admin/views/hdcloud/clues/get_adviser.php b/admin/views/hdcloud/clues/get_adviser.php index 663f9676..b236f47f 100755 --- a/admin/views/hdcloud/clues/get_adviser.php +++ b/admin/views/hdcloud/clues/get_adviser.php @@ -6,10 +6,11 @@
- +
@@ -34,6 +35,7 @@
+
@@ -84,17 +85,6 @@
-
- -
@@ -124,9 +114,9 @@
-
+