diff --git a/api/controllers/plan/Xzcall.php b/api/controllers/plan/Xzcall.php index 85e814da..28239358 100644 --- a/api/controllers/plan/Xzcall.php +++ b/api/controllers/plan/Xzcall.php @@ -8,6 +8,7 @@ * Time: 19:15 */ require_once COMMPATH . 'third_party/Xcall/Xcall.php'; + class Xzcall extends HD_Controller { @@ -80,7 +81,7 @@ class Xzcall extends HD_Controller ]; $xcall = new Xcall($params); //解绑 - $result = $xcall -> AXBUnbind($data['to'],$data['from'],$data['virtualMobile']); + $result = $xcall->AXBUnbind($data['to'], $data['from'], $data['virtualMobile']); //删除redis $cache_key = "XZ_LICHEB_MOBILEA_{$data['from']}_MOBILEB_{$data['to']}_{$row['cf_uid']}"; $redis = &load_cache('redis'); @@ -93,6 +94,11 @@ class Xzcall extends HD_Controller } $this->load->library('receiver/customers_entity'); $this->customers_entity->add_log($cust['id'], $row['cf_uid'], $data['uname'], $row['id'], 2); + if ($row['cf_title'] == 'customer') {//更新客户已回访 + $this->load->model('receiver/receiver_customers_visit_model', 'mdCustomersVisit'); + $this->mdCustomersVisit->update(array('contact' => 2, 'status' => 2) + , array('c_id' => $row['cf_id'], 'contact' => 1, 'status' => 1)); + } } } else { debug_log("error: 未找到拨打记录", $this->log_file); @@ -112,9 +118,9 @@ class Xzcall extends HD_Controller if ($row) { $jsondata = json_decode($row['json_data'], true); if ($data['getFileUrl']) { - if($data['id']==1206){ + if ($data['id'] == 1206) { $params = $this->admin_config; - }else{ + } else { $this->config->load('xcall'); $params = [ 'app_id' => $this->config->item('app_id'), @@ -132,11 +138,6 @@ class Xzcall extends HD_Controller debug_log('error:文件上传七牛失败', $this->log_file); } else { $up_data['rec_url'] = $q_res['url']; - if($row['cf_platform']=='api' && $row['cf_title']=='customer'){//更新客户回访 - $this->load->model('receiver/receiver_customers_visit_model', 'mdCustomersVisit'); - $this->mdCustomersVisit->update(array('contact' => 2,'status' => 2) - , array('c_id' => $row['cf_id'], 'contact' => 1,'status' => 1)); - } } } else { debug_log('error:' . json_encode($result, JSON_UNESCAPED_UNICODE), $this->log_file); @@ -167,34 +168,38 @@ class Xzcall extends HD_Controller $date = date("Y-m-d H:i:s.x", $usec); return $mescdate = str_replace('x', $sec, $date); } + //执行企业微信机器人 - public function dorobot(){ + public function dorobot() + { $o_id = $this->input->get('id'); - if($o_id){ + if ($o_id) { $this->load->library('qyrobot'); $robot_res = $this->qyrobot->deposit_notify($o_id); var_dump($robot_res); } } + //更新订单金融服务费 - public function up_srv_money(){ + public function up_srv_money() + { $o_id = $this->input->get('id'); $show = $this->input->get('show'); $money = $this->input->get('money'); - $row = $this->orders_model->get(['id'=>$o_id]); - if(!$row){ + $row = $this->orders_model->get(['id' => $o_id]); + if (!$row) { return false; } - if($show){ + if ($show) { print_r($row); } - if($money){ - $money_json = json_decode($row['money_json'],true); + if ($money) { + $money_json = json_decode($row['money_json'], true); $money_json['price_finance'] = 0; $up_data = [ - 'money_json' => json_encode($money_json,JSON_UNESCAPED_UNICODE) + 'money_json' => json_encode($money_json, JSON_UNESCAPED_UNICODE) ]; - $res = $this->orders_model->update($up_data,['id'=>$row['id']]); + $res = $this->orders_model->update($up_data, ['id' => $row['id']]); var_dump($res); } diff --git a/api/controllers/wxapp/licheb/Customers.php b/api/controllers/wxapp/licheb/Customers.php index 30530fec..f79deca5 100644 --- a/api/controllers/wxapp/licheb/Customers.php +++ b/api/controllers/wxapp/licheb/Customers.php @@ -549,8 +549,16 @@ class Customers extends Wxapp $count = $this->mdCustomersVisit->count_visit($where); $lists = []; if ($count) { - $fileds = 'a.id,a.name,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.defeat_time'; + $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.defeat_time'; $rows = $this->mdCustomersVisit->select_visit($where, 'a.id desc', $page, $size, $fileds); + //获取管理员 + $admin_arr = array_unique(array_column($rows, 'admin_id')); + $admin_ids = implode(',', $admin_arr); + $admins = []; + 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'); @@ -568,7 +576,7 @@ class Customers extends Wxapp '颜色型号' => $color . '-' . $version, '建卡时间' => date('Y-m-d', $val['c_time']), '客户来源' => $val['cf_title'], - '销售顾问' => $this->session['uname'] ? $this->session['uname'] : '', + '销售顾问' => isset($admins[$val['admin_id']]) ? $admins[$val['admin_id']][0]['uname'] : '', ]; $val['cont_time'] != '0000-00-00 00:00:00' && $other_data['上次联系'] = date('Y-m-d', strtotime($val['cont_time'])); $tags = [$val['level'] . '级用户'];