Commit 21606266 authored by zfc's avatar zfc

容联云and阿里云订单表合并

parent 37ab51d3
......@@ -212,4 +212,17 @@ class SecretReport extends Model
}
return $price;
}
/**
* @param $field
* @param $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getArr($field,$where){
$r =$this->field($field)->where($where)->select();
return $r;
}
}
......@@ -75,18 +75,18 @@ class PrivacyNumber
/*容联云音频下载*/
$rongRecord = new RongBilledInform();
$ids=array();
$field='id,mp3_url';
$where='download=0';
$field='id,voice_file';
$where='record_down=0';
$down_data2=$rongRecord->getArr($field,$where);
if($down_data2) {
foreach ($down_data2 as $k => $v) {
$ids[] = $v['id'];
$down_url2 = explode('/', $v['mp3_url']);
down_file($v['mp3_url'], ROOT_PATH . 'public' . DS . 'static' . DS . 'voice', array_pop($down_url2));
$down_url2 = explode('/', $v['voice_file']);
down_file($v['voice_file'], ROOT_PATH . 'public' . DS . 'static' . DS . 'voice', array_pop($down_url2));
}
}
$id_str=implode(',',$ids);
$update['download']=1;
$update['record_down']=1;
$where=" id in($id_str)";
$rongRecord->save($update,$where);
......@@ -142,17 +142,32 @@ class PrivacyNumber
$params = Request::instance()->param();
/*搜索A经纪人agent_id and B客户 user_id */
$date=[
'call_id' => $params['callId'],
'phone_no' => $params['callerNum'],/*A*/
'secret_no' => $params['calleeNum'],/*X*/
'peer_no' => $params['servingNum'],/*B*/
'start_time' => $params['answerTime'],/*被叫接听时间*/
'call_time' => $params['startTime'],/*本次通话开始时间*/
'release_time' => $params['endTime'],/*本次通话结束时间*/
'ring_time' => $params['calleeRingTime'],/*被叫振铃时间*/
'time' => $params['duration'],/*本次通话时间*/
'release_dir' => $params['result'],/*本次通话的结果,0 成功2无应答 9呼叫失败 11*/
'mapping_id' => $params['mappingId'],/*绑定容联云id*/
'type' =>2,
'call_display' => $params['calldisplay'],
];
$phone_a=$params['callerNum'];
if ($phone_a) {
$agents_id = Db::table('agents')->where("phone='{$phone_a}' AND password IS NOT NULL")->value('id');
if (empty($agents_id)) {
$agents_id = Db::table('a_agents_phone')->where('phone',$phone_a)->value('agents_id');
}
$params['agents_id'] = $agents_id;
$params['users_id'] = Db::table('u_users')->where('user_phone',$phone_a)->value('id');
$date['agents_id'] = $agents_id;
$date['users_id'] = Db::table('u_users')->where('user_phone',$phone_a)->value('id');
}
$report = new RongBilledInform();
$report->allowField(true)->save($params);
$report = new SecretReport();
$report->allowField(true)->save($date);
$str=date('Y-m-d h:i:s').' 容联云话单'.var_export($params,true);
......@@ -163,9 +178,9 @@ class PrivacyNumber
//录音通知
public function rongRecordingInformUrl(){
$params = Request::instance()->param();
$report = new RongBilledInform();
$where['callId']=$params['callId'];
$update['mp3_url']=$params['recordUrl'];
$report = new SecretReport();
$where['call_id']=$params['callId'];
$update['voice_file']=$params['recordUrl'];
$report->save($update,$where);
$str=date('Y-m-d h:i:s').' 容联云录音'.var_export($params,true);
Log::write($str,'rongRecordingInformUrl'); //记录日志
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment