'010', '350000' => '0592', '430000' => '0731', ); function __construct($inputs, $app_key) { parent::__construct($inputs, $app_key); $this->login_white = array();//登录白名单 $this->check_status = array();//用户状态校验 $this->check_mobile = array();//需要手机号 $this->check_headimg = array();//授权微信信息 $this->load->model("biz/biz_model"); $this->load->model('receiver/receiver_customers_model', 'customers_model'); $this->load->model('receiver/receiver_yx_model'); $this->log_file = 'call.log'; } protected function get() { $id = $this->input_param('id'); $session = $this->session; $admin_id = $session['uid']; $cf_title = 'customer'; $cus_id = $id; $row = $this->customers_model->get(['id' => $cus_id]); if (!$row || !$row['mobile']) { throw new Hd_Exception('用户不存在', API_CODE_INVILD_PARAM); } $customer_mobile = $row['mobile']; $user_mobile = $session['mobile']; $json = $session['jsondata'] ? json_decode($session['jsondata'], true) : array(); if ($json && $json['licheb'] && $json['licheb']['tel']) { $user_mobile = $json['licheb']['tel']; } $biz = $this->biz_model->get(array('id' => $row['biz_id'])); $areaCode = $this->areaCodes[$biz['province_id']]; $redis = &load_cache('redis'); $cache_key = "XZ_LICHEB_MOBILEA_{$user_mobile}_MOBILEB_{$customer_mobile}_{$admin_id}"; $call_mobile = $redis->get($cache_key); if (!$call_mobile) { $seq_id = create_order_no(); $ycall = new Ycall(); $maxBindingTime = 15;//绑定时间 //$result = $ycall->ABXbind($user_mobile, $customer_mobile, $seq_id, $maxBindingTime); $result = $ycall->ABXbind($user_mobile, $customer_mobile, $seq_id, $maxBindingTime, '', '', 1, $areaCode); if ($result['result'] != '000000') { //绑定失败 debug_log("xz_failed_bind:customer_mobile【{$customer_mobile}】", $this->log_file); debug_log("xz_result:" . json_encode($result, JSON_UNESCAPED_UNICODE), $this->log_file); throw new Hd_Exception($result['message'], API_CODE_FAIL); } else { $call_mobile = $result['middleNumber']; $add_data = [ 'bind_id' => $result['bindId'], 'call_id' => $seq_id, 'user_mobile' => $user_mobile, 'display_number' => $call_mobile, 'biz_id' => $row['biz_id'], 'cf_id' => $cus_id, 'cf_uid' => $admin_id, 'cf_title' => $cf_title, 'cf_platform' => 'api', 'json_data' => json_encode(['uname' => $session['uname']], JSON_UNESCAPED_UNICODE), 'c_time' => time() ]; $this->receiver_yx_model->add($add_data); $redis->save($cache_key, $call_mobile, 120); } } $data['mobile'] = $call_mobile; return $data; } }