diff --git a/admin/config/xcall.php b/admin/config/xcall.php new file mode 100644 index 00000000..d61fa5fc --- /dev/null +++ b/admin/config/xcall.php @@ -0,0 +1,12 @@ +input->get('mobile'); - $type = intval($this->input->get('type')); + $type = $this->input->get('type'); $id = intval($this->input->get('id')); + if (!$id || !$type) { + return $this->show_json(SYS_CODE_FAIL, '参数错误!'); + } + if ($type == 'clues') { + $this->load->model('receiver/receiver_clues_model', 'mdClues'); + $re = $this->mdClues->get(array('id' => $id)); + } else if ($type == 'customer') { + $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $re = $this->mdCustomers->get(array('id' => $id)); + } + if (!$re['mobile']) { + return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); + } + $mobile = $re['mobile']; $content = ''; $mobile_edit = 0; - if ($type == 1) { - $mobile_sub = $mobile ? substr_replace($mobile, '****', 3, 4) : ''; - } else if ($type == 2) { - $content = '尊敬的合作伙伴您好!我是好店云的客服,已为您分配了一个订单,请及时登录好店云小程序进行处理,感谢您的支持与配合,祝您生活愉快!'; - if ($id) { - $this->load->model('app/jdb/receiver_orders_model', 'mdReceiverOrders'); - $this->load->model('user/user_biz_model', 'mdUserBiz'); - $this->load->model('user/user_model', 'mdUser'); - $reOrders = $this->mdReceiverOrders->get(array('id' => $id), 'brand_id,biz_id'); - $reUserBiz = array(); - if ($reOrders['biz_id']) { - $reUserBiz = $this->mdUserBiz->select(array('biz_id' => $reOrders['biz_id'], 'type' => 1) - , 'id ASC', 0, 0, 'uid'); - } else if ($reOrders['brand_id']) { - $reUserBiz = $this->mdUserBiz->select(array('brand_id' => $reOrders['brand_id'], 'type' => 0) - , 'id ASC', 0, 0, 'uid'); - } - if ($reUserBiz) { - foreach ($reUserBiz as $key => $value) { - $reUser = $this->mdUser->get(array('uid' => $value['uid'], 'status' => 1), 'mobile'); - $reUser['mobile'] && $mobile = $mobile ? $mobile . ',' . $reUser['mobile'] : $reUser['mobile']; - } - } - } - $mobile_sub = $mobile; - $mobile_edit = 1; - } else { - $mobile_sub = $mobile ? substr_replace($mobile, '****', 3, 4) : ''; - } + $mobile_sub = $mobile ? substr_replace($mobile, '*****', 0, 5) : ''; $this->data['mobile_sub'] = $mobile_sub; - $this->data['mobile'] = $mobile; $this->data['mobile_edit'] = $mobile_edit; $this->data['id'] = $id; $this->data['type'] = $type; @@ -1060,13 +1044,20 @@ class Common extends CI_Controller */ public function send_sms() { - $mobile = $this->input->post('mobile'); $content = $this->input->post('content'); - $type = intval($this->input->post('type')); + $type = $this->input->post('type'); $id = intval($this->input->post('id')); - if (!$mobile) { - return $this->show_json(SYS_CODE_FAIL, '请输入手机号'); + if ($type == 'clues') { + $this->load->model('receiver/receiver_clues_model', 'mdClues'); + $re = $this->mdClues->get(array('id' => $id)); + } else if ($type == 'customer') { + $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $re = $this->mdCustomers->get(array('id' => $id)); } + if (!$re['mobile']) { + return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); + } + $mobile = $re['mobile']; if (!$content) { return $this->show_json(SYS_CODE_FAIL, '请输入短信内容'); } @@ -1076,11 +1067,7 @@ class Common extends CI_Controller if (mb_strlen($content) > 300) { return $this->show_json(SYS_CODE_FAIL, '短信最多300个字'); } - if ($type == 1) { - $content = '【狸车】' . $content; - } else if ($type == 2) { - $content = '【好店云】' . $content; - } + $content = '【狸车】' . $content; $plaintext = ''; if (strstr($mobile, ',')) { //多个手机号 $mobiles = explode(',', $mobile); @@ -1097,16 +1084,21 @@ class Common extends CI_Controller $this->data['content'] = $content; $this->data['result'] = $plaintext; if ($plaintext) { - if ($id && $type == 1) { - $this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs'); + if ($id) { $data = array( - 'clue_id' => $id, 'uid' => $this->uid, 'uname' => $this->username, 'type' => 1, 'log' => $content, 'c_time' => time() ); + if ($type == 'clues') { + $this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs'); + $data['clue_id'] = $id; + } else if ($type == 'customer') { + $this->load->model('receiver/receiver_customer_oplogs_model', 'mdOplogs'); + $data['customer_id'] = $id; + } $this->mdOplogs->add($data);//增加操作记录 } return $this->show_json(SYS_CODE_SUCCESS, '发送短信成功'); @@ -1115,6 +1107,74 @@ class Common extends CI_Controller } } + /** + * Notes:绑定晓致虚似号手机 + * Created on: 2021/7/28 11:17 + * Created by: dengbw + * @return bool + */ + public function bind_mobile() + { + $params = $this->input->get(); + $id = intval($params['id']); + $type = $params['type']; + if (!$id || !$type) { + return $this->show_json(SYS_CODE_FAIL, '参数错误!'); + } + $this->load->model('receiver/receiver_xz_model', 'mdReceiverXz'); + if ($type == 'clues') { + $this->load->model('receiver/receiver_clues_model', 'mdClues'); + $re = $this->mdClues->get(array('id' => $id)); + } else if ($type == 'customer') { + $this->load->model('receiver/receiver_customers_model', 'mdCustomers'); + $re = $this->mdCustomers->get(array('id' => $id)); + } + if (!$re['mobile']) { + return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); + } + $mobile = $re['mobile']; + $cache = &load_cache('redis'); + $xz_admin_phone = $cache->get('xz_admin_phone'); + $middleNumber = ''; + if ($xz_admin_phone) { + $middleNumber = $xz_admin_phone['admins'][$this->uid]; + } + if (!$middleNumber) { + return $this->show_json(SYS_CODE_FAIL, '还未分配号码不可使用'); + } + $this->load->helper('order'); + $seq_id = create_order_no(); + require_once COMMPATH . 'third_party/Xcall/Xcall.php'; + $xcall = new Xcall(); + $result = $xcall->SWbind($mobile, $seq_id, $middleNumber); + if ($result['t_code'] == '-26') {//已经绑定解绑 + $s_res = $xcall->Searchbind($middleNumber); + $bined_mobile = $s_res['data']['value'];//已绑定手机号 + if ($bined_mobile) { + $xcall->SWunbind($bined_mobile, $middleNumber);//解绑 + $result = $xcall->SWbind($mobile, $seq_id, $middleNumber); + } + } + if ($result['code']) { + $this->data['middlenumber'] = $result['data']['virtualMobile']; + $add_data = [ + 'call_id' => $seq_id, + 'display_number' => $result['data']['virtualMobile'], + 'cf_id' => $id, + 'cf_uid' => $this->uid, + 'cf_title' => $type, + 'cf_platform' => 'admin', + 'c_time' => time() + ]; + $this->mdReceiverXz->add($add_data); + } else { + return $this->show_json(SYS_CODE_FAIL, $result['msg']); + } + $this->data['mobile_sub'] = substr_replace($mobile, '*****', 0, 5); + $this->data['id'] = $id; + $this->show_view('common/bind_mobile'); + } + /** * Notes: 获取七牛token * Created on: 2020/4/16 14:27 diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php index 2ea48383..34dd9e1c 100644 --- a/admin/controllers/receiver/Clues.php +++ b/admin/controllers/receiver/Clues.php @@ -69,6 +69,7 @@ class Clues extends HD_Controller $val['cf_title'] = isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : ''; $val['status_name'] = $status_arr[$val['status']]; $val['admin_name'] = isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : ''; + $val['mobile_sub'] = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : ''; $lists[] = $val; } } @@ -116,7 +117,7 @@ class Clues extends HD_Controller $rec_text = '未接通'; $row = $this->mdReceiverXz->get(array('id' => $value['log'])); if ($row['duration']) { - $rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0,0,'video') : ''; + $rec_url = $row['rec_url'] ? build_qiniu_image_url($row['rec_url'], 0, 0, 'video') : ''; $rec_text = '录音文件未生成'; } } @@ -467,61 +468,6 @@ class Clues extends HD_Controller return $this->show_json(SYS_CODE_SUCCESS, '分配成功!'); } - //晓致绑定手机号 - public function get_xbind() - { - $params = $this->input->get(); - $id = intval($params['id']); - if (!$id) { - return $this->show_json(SYS_CODE_FAIL, '参数错误!'); - } - $re = $this->clues_model->get(array('id' => $id)); - if (!$re['mobile']) { - return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); - } - $mobile = $re['mobile']; - $cache = &load_cache('redis'); - $xz_admin_phone = $cache->get($this->cacheKeyPhone); - $middleNumber = ''; - if ($xz_admin_phone) { - $middleNumber = $xz_admin_phone['admins'][$this->uid]; - } - if (!$middleNumber) { - return $this->show_json(SYS_CODE_FAIL, '还未分配号码不可使用'); - } - $this->load->helper('order'); - $seq_id = create_order_no(); - require_once COMMPATH . 'third_party/Xcall/Xcall.php'; - $xcall = new Xcall(); - $result = $xcall->SWbind($mobile, $seq_id, $middleNumber); - if ($result['t_code'] == '-26') {//已经绑定解绑 - $s_res = $xcall->Searchbind($middleNumber); - $bined_mobile = $s_res['data']['value'];//已绑定手机号 - if ($bined_mobile) { - $xcall->SWunbind($bined_mobile, $middleNumber);//解绑 - $result = $xcall->SWbind($mobile, $seq_id, $middleNumber); - } - } - if ($result['code']) { - $this->data['middlenumber'] = $result['data']['virtualMobile']; - $add_data = [ - 'call_id' => $seq_id, - 'display_number' => $result['data']['virtualMobile'], - 'cf_id' => $id, - 'cf_uid' => $this->uid, - 'cf_title' => 'clues', - 'cf_platform' => 'admin', - 'c_time' => time() - ]; - $this->mdReceiverXz->add($add_data); - } else { - return $this->show_json(SYS_CODE_FAIL, $result['msg']); - } - $this->data['mobile_sub'] = substr_replace($mobile, '*****', 0, 5); - $this->data['id'] = $id; - $this->show_view('receiver/clues/edit_xbind'); - } - public function lists_call() { $this->load->model('sys/sys_admin_model', 'mdAdmin'); @@ -573,11 +519,12 @@ class Clues extends HD_Controller } $cache = &load_cache('redis'); $xz_admin_phone = $cache->get($this->cacheKeyPhone); - $mobiles = $this->mdReceiverXz->get_mobiles('admin'); - shuffle($mobiles); + $this->config->load('xcall', TRUE); + $mobiles = $this->config->item('mobile_list', 'xcall'); + $mobiles && shuffle($mobiles); if ($type == 0) {//分配手机 if (!$mobiles) { - return $this->show_json(SYS_CODE_FAIL, '暂无虚似号'); + return $this->show_json(SYS_CODE_FAIL, '无号码库!'); } $number = ''; foreach ($mobiles as $key => $value) { @@ -602,7 +549,10 @@ class Clues extends HD_Controller return $this->show_json(SYS_CODE_SUCCESS, '取消分配成功'); } else if ($type == 3) {//全部重新分配 if (!$mobiles) { - return $this->show_json(SYS_CODE_FAIL, '暂无虚似号'); + return $this->show_json(SYS_CODE_FAIL, '无号码库!'); + } + if (!$xz_admin_phone['admins']) { + return $this->show_json(SYS_CODE_FAIL, '未分配号码,不能重置'); } $xz_admin_phone_new = array(); $i = 0; diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 84da3e91..1f68c3e6 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -1,31 +1,36 @@ '客户手机号', 'name' => '客户姓名'); protected $log_dir; - public function __construct(){ + public function __construct() + { parent::__construct(); $this->load->model('receiver/receiver_customers_model', 'customers_model'); $this->load->model('receiver/receiver_customer_oplogs_model', 'customer_oplogs_model'); $this->load->model('receiver/receiver_xz_model'); $this->load->model('app/licheb/app_licheb_users_model'); $this->load->model("biz/biz_model"); - $this->log_dir = 'receiver_'. get_class($this); + $this->log_dir = 'receiver_' . get_class($this); } - public function index(){ + public function index() + { return $this->lists(); } - public function lists(){ + public function lists() + { $status_arr = $this->customers_model->get_status(); unset($status_arr['-1']); $params = $this->input->get(); @@ -53,17 +58,18 @@ class Customer extends HD_Controller{ $count = $this->customers_model->count($where); $lists = []; - if($count){ + if ($count) { $fileds = 'id,name,mobile,cf_title,c_time,admin_id,status'; - $rows = $this->customers_model->select($where,'id desc',$page,$size,$fileds); + $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); //获取销售员 - $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'); - foreach($rows as $key => $val){ + $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'); + foreach ($rows as $key => $val) { $lists[] = array( 'id' => $val['id'], 'name' => $val['name'], - 'mobile' => $val['mobile'] ? substr_replace($val['mobile'], '****', 3, 4) : '', + 'mobile' => $val['mobile'], + 'mobile_sub' => $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : '', 'cf_title' => $val['cf_title'], 'status_name' => $status_arr[$val['status']], 'admin_name' => isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '', @@ -80,7 +86,8 @@ class Customer extends HD_Controller{ return $this->show_view('receiver/customer/lists', true); } - public function get(){ + public function get() + { $id = $this->input->get('id'); $this->load->model("biz/biz_model"); @@ -88,12 +95,12 @@ class Customer extends HD_Controller{ $this->load->model('auto/auto_series_model'); $row = $this->customers_model->get(array('id' => $id)); - if(!$row){ + if (!$row) { return $this->show_json(SYS_CODE_FAIL, '客户不存在!'); } - $if_driver = 1 == $row['if_driver'] ? '是':'否'; - $is_top = 1 == $row['is_top'] ? '是':'否'; + $if_driver = 1 == $row['if_driver'] ? '是' : '否'; + $is_top = 1 == $row['is_top'] ? '是' : '否'; $car_json = json_decode($row['car_json'], true); $side = $car_json['version']['title'] ? $car_json['version']['title'] : ''; $color = $car_json['color']['title'] ? $car_json['color']['title'] : ''; @@ -102,7 +109,7 @@ class Customer extends HD_Controller{ $row_brand = $this->auto_brand_model->get(array('id' => $row['brand_id']), 'name'); $row_seriy = $this->auto_series_model->get(array('id' => $row['s_id']), 'name'); //获取销售员 - $row_admin = $this->app_licheb_users_model->get(array('id' => $row['admin_id']),'id,uname'); + $row_admin = $this->app_licheb_users_model->get(array('id' => $row['admin_id']), 'id,uname'); //操作日志 $rows_log = $this->customer_oplogs_model->select(array('customer_id' => $id), 'c_time desc', 0, 0); @@ -111,7 +118,7 @@ class Customer extends HD_Controller{ $info = array( 'id' => $row['id'], 'name' => $row['name'], - 'mobile' => substr_replace($row['mobile'], '****', 3, 4), + 'mobile' => $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : '', 'cf_title' => $row['cf_title'], 'c_time' => date('Y-m-d H:i:s', $row['c_time']), 'status' => $row['status'], @@ -145,15 +152,13 @@ class Customer extends HD_Controller{ //操作日志 $logs = array(); foreach ($rows_log as $key => $value) { - $type_name = '小记'; $rec_text = $rec_url = ''; - if($value['type']==2){ - $type_name = '拨打电话'; - $rec_row = $this->receiver_xz_model->get(['id'=>$value['log']],'rec_url,duration'); - if($rec_row['duration']){ + if ($value['type'] == 2) { + $rec_row = $this->receiver_xz_model->get(['id' => $value['log']], 'rec_url,duration'); + if ($rec_row['duration']) { $rec_row['rec_url'] && $rec_url = $rec_row['rec_url']; !$rec_row['rec_url'] && $rec_text = '录音暂未生成'; - }else{ + } else { $rec_text = '未接通'; } } @@ -162,7 +167,7 @@ class Customer extends HD_Controller{ 'log' => $value['log'], 'rec_url' => $rec_url, 'rec_text' => $rec_text, - 'type_name' => $type_name, + 'type_name' => $this->customer_oplogs_model->typeAry()[$value['type']], 'c_time' => date('Y-m-d H:i', $value['c_time']) ); } @@ -179,7 +184,8 @@ class Customer extends HD_Controller{ return $this->show_view('receiver/customer/get', true); } - public function add(){ + public function add() + { // TODO: Implement add() method. } @@ -187,7 +193,8 @@ class Customer extends HD_Controller{ * 新增日志 * @return bool */ - function add_log(){ + function add_log() + { $params = $this->input->post(); if (!$params['id']) { return $this->show_json(SYS_CODE_FAIL, '参数错误!'); @@ -216,14 +223,15 @@ class Customer extends HD_Controller{ * 编辑 * @return bool */ - public function edit(){ + public function edit() + { $info = $this->input->post('info'); if (!$info) { return $this->show_json(SYS_CODE_FAIL, '非法参数!'); } $row = $this->customers_model->get(array('id' => $info['id'])); - if(!$row){ + if (!$row) { return $this->show_json(SYS_CODE_FAIL, '客户信息不存在!'); } @@ -264,15 +272,18 @@ class Customer extends HD_Controller{ return $this->show_json($code, $msg); } - public function del(){ + public function del() + { // TODO: Implement del() method. } - public function batch(){ + public function batch() + { // TODO: Implement batch() method. } - public function export(){ + public function export() + { // TODO: Implement export() method. } diff --git a/admin/views/receiver/clues/edit_xbind.php b/admin/views/common/bind_mobile.php similarity index 100% rename from admin/views/receiver/clues/edit_xbind.php rename to admin/views/common/bind_mobile.php diff --git a/admin/views/common/show_sms.php b/admin/views/common/show_sms.php index 844dc242..a23a4cb8 100755 --- a/admin/views/common/show_sms.php +++ b/admin/views/common/show_sms.php @@ -1,6 +1,5 @@
-
diff --git a/admin/views/receiver/clues/edit.php b/admin/views/receiver/clues/edit.php index 76030e00..c915a8f7 100644 --- a/admin/views/receiver/clues/edit.php +++ b/admin/views/receiver/clues/edit.php @@ -59,7 +59,7 @@
- +
- +
@@ -101,13 +101,13 @@
- 短信
拨打电话 @@ -131,8 +131,7 @@
- +
- + @@ -114,14 +115,14 @@
@@ -197,14 +198,14 @@ return $.form.modal("/receiver/clues/get_adviser?ids=" + ids, 'open_type=modal', "分配顾问"); } - function load_clue(){ + function load_clue() { var file = $("#clue-file"); if (file.val() == '') { layer.msg('文件是空的'); return 0; } var loading = layer.load(1, { - shade: [0.1,'#fff'] //0.1透明度的白色背景 + shade: [0.1, '#fff'] //0.1透明度的白色背景 }); var options = { @@ -213,7 +214,7 @@ dataType: "json", data: {}, success: function (res) { - if(1 == res.code){ + if (1 == res.code) { layer.msg(res.msg, { icon: 1, time: 2000 @@ -230,8 +231,8 @@ $("#import-form").ajaxSubmit(options); } - $(function(){ - $("#import").click(function(){ + $(function () { + $("#import").click(function () { $("#clue-file").val(''); layer.open({ type: 1, diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php index 46c7e8f1..c6f31f57 100644 --- a/admin/views/receiver/customer/get.php +++ b/admin/views/receiver/customer/get.php @@ -73,24 +73,24 @@ - +
@@ -455,7 +454,7 @@ } .input-group-addon { - padding: 0px 10px 0px 0px; + padding: 0px 0px 0px 0px; font-size: 1.6rem; font-weight: normal; line-height: 0px; @@ -464,7 +463,7 @@ background-color: #fff; border: 0px solid #fff; border-radius: 0px; - width: 120px; + width: 110px; } .table-td { diff --git a/admin/views/receiver/clues/lists.php b/admin/views/receiver/clues/lists.php index 750c95a2..daf5a007 100644 --- a/admin/views/receiver/clues/lists.php +++ b/admin/views/receiver/clues/lists.php @@ -72,7 +72,8 @@
+ data-modal="/receiver/clues/get_add" data-title="新增线索">新增 +
@@ -102,7 +103,7 @@
diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index 15d33d0e..63c7218f 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -75,28 +75,34 @@
@@ -135,26 +141,26 @@ }); var vue_obj; - $(function(){ + $(function () { vue_obj = new Vue({ el: '.coms-table-wrap', data: { - params:[], - searchTpAry:[], - lists:[] + params: [], + searchTpAry: [], + lists: [] }, - mounted:function() { + mounted: function () { var vm = this; vm.params = ; vm.searchTpAry = ; vm.lists = ; }, - methods:{ - saveEdit:function(){ + methods: { + saveEdit: function () { $("form").submit(); } }, - watch:{} + watch: {} }); diff --git a/api/controllers/plan/Xzcall.php b/api/controllers/plan/Xzcall.php index f20f1eb0..02ea585a 100644 --- a/api/controllers/plan/Xzcall.php +++ b/api/controllers/plan/Xzcall.php @@ -17,9 +17,8 @@ class Xzcall extends HD_Controller parent::__construct(); $this->log_file = 'call_xz.log'; $this->load->model('receiver/receiver_xz_model'); - - $this->load->model('receiver/receiver_customers_model','customers_model'); - $this->load->model('receiver/order/receiver_orders_model','orders_model'); + $this->load->model('receiver/receiver_customers_model', 'customers_model'); + $this->load->model('receiver/order/receiver_orders_model', 'orders_model'); } public function index() @@ -46,37 +45,42 @@ class Xzcall extends HD_Controller $data['callEnd'] && $up_data['end_time'] = $this->getMsecToMescdate($data['callEnd']); $up_data['json_data'] = json_encode($data, JSON_UNESCAPED_UNICODE); $this->receiver_xz_model->update($up_data, ['id' => $row['id']]); - if ($row['cf_id'] && $row['cf_platform'] == 'admin' && $row['cf_title'] == 'clues') { //后台线索池拨打电话回调 + if ($row['cf_id'] && $row['cf_platform'] == 'admin') { //后台 $admin_id = $row['cf_uid']; $this->load->model('sys/sys_admin_model'); - $this->load->model('receiver/receiver_clue_oplogs_model','mdOplogs'); $admin = $this->sys_admin_model->get(array('id' => $admin_id)); $addData = array( - 'clue_id' => $row['cf_id'], 'uid' => $admin_id, 'uname' => $admin['username'] ? $admin['username'] : '', 'type' => 2,//类型 0 普通 1短信 2电话 'log' => $row['id'], 'c_time' => time() ); + if ($row['cf_title'] == 'clues') {//线索拨打电话回调 + $this->load->model('receiver/receiver_clue_oplogs_model', 'mdOplogs'); + $addData['clue_id'] = $row['cf_id']; + } else if ($row['cf_title'] == 'customer') {//客户拨打电话回调 + $this->load->model('receiver/receiver_customer_oplogs_model', 'mdOplogs'); + $addData['customer_id'] = $row['cf_id']; + } $this->mdOplogs->add($addData); require_once COMMPATH . 'third_party/Xcall/Xcall.php'; $xcall = new Xcall(); //解绑 $xcall->SWunbind($data['to'], $data['virtualMobile']); - }elseif($row['cf_id'] && $row['cf_platform'] == 'api'){ //狸车宝 - require_once COMMPATH.'third_party/Xcall/Xcall.php'; + } elseif ($row['cf_id'] && $row['cf_platform'] == 'api') { //狸车宝 + require_once COMMPATH . 'third_party/Xcall/Xcall.php'; $xcall = new Xcall(); //解绑 - $result = $xcall -> SWunbind($data['to'],$data['virtualMobile']); - if($row['cf_title']=='order'){ //订单 - $cust = $this->orders_model->get(['id'=>$row['cf_id']]); + $result = $xcall->SWunbind($data['to'], $data['virtualMobile']); + if ($row['cf_title'] == 'order') { //订单 + $cust = $this->orders_model->get(['id' => $row['cf_id']]); $this->load->library('receiver/orders_entity'); - $this->orders_entity->add_log($cust['id'],$row['cf_uid'],$data['uname'],$row['id'],2); - }else{ //客户 - $cust = $this->customers_model->get(['id'=>$row['cf_id']]); + $this->orders_entity->add_log($cust['id'], $row['cf_uid'], $data['uname'], $row['id'], 2); + } else { //客户 + $cust = $this->customers_model->get(['id' => $row['cf_id']]); $this->load->library('receiver/customers_entity'); - $this->customers_entity->add_log($cust['id'],$row['cf_uid'],$data['uname'],$row['id'],2); + $this->customers_entity->add_log($cust['id'], $row['cf_uid'], $data['uname'], $row['id'], 2); } //删除redis $cache_key = "XZ_LICHEB_MOBILEB_{$cust['mobile']}_{$row['cf_uid']}"; @@ -106,7 +110,7 @@ class Xzcall extends HD_Controller $result = $xcall->getFile($data['getFileUrl'], $data['mid'], $data['tag']); if ($result['code']) { //上传七牛 $this->load->library('qiniu'); - $qiniu = new Qiniu(['type'=>'video']); + $qiniu = new Qiniu(['type' => 'video']); $filename = $qiniu->getFileName($data['mid'], 'mp3', 'xz_video_'); $q_res = $qiniu->save($filename, $result['data']); if (!$q_res) { diff --git a/common/models/receiver/Receiver_customer_oplogs_model.php b/common/models/receiver/Receiver_customer_oplogs_model.php index 163ebaa8..dcca1be6 100644 --- a/common/models/receiver/Receiver_customer_oplogs_model.php +++ b/common/models/receiver/Receiver_customer_oplogs_model.php @@ -16,5 +16,16 @@ class Receiver_customer_oplogs_model extends HD_Model { parent::__construct($this->table_name, 'default'); } + + /** + * Notes:类型 + * Created on: 2021/7/27 10:31 + * Created by: dengbw + * @return array + */ + public function typeAry() + { + return array(0 => '小记', 1 => '发短信', 2 => '拨打号码'); + } } diff --git a/common/models/receiver/Receiver_xz_model.php b/common/models/receiver/Receiver_xz_model.php index 7909fc82..93229f50 100644 --- a/common/models/receiver/Receiver_xz_model.php +++ b/common/models/receiver/Receiver_xz_model.php @@ -15,25 +15,4 @@ class Receiver_xz_model extends HD_Model { parent::__construct($this->table_name, 'default'); } - - /** - * Notes:虚似号码 - * Created on: 2021/7/26 14:20 - * Created by: dengbw - * @param string $type - * @return array - */ - public function get_mobiles($type = 'admin') - { - if ($type == 'api') {//小程序接口专用 - $mobile = array( - '18916735350','18916689195', - ); - } else {//后台专用 - $mobile = array( - '18916735350','18916689195', - ); - } - return $mobile; - } }