Commit 21606266 authored by zfc's avatar zfc

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

parent 37ab51d3
...@@ -212,4 +212,17 @@ class SecretReport extends Model ...@@ -212,4 +212,17 @@ class SecretReport extends Model
} }
return $price; 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 ...@@ -75,18 +75,18 @@ class PrivacyNumber
/*容联云音频下载*/ /*容联云音频下载*/
$rongRecord = new RongBilledInform(); $rongRecord = new RongBilledInform();
$ids=array(); $ids=array();
$field='id,mp3_url'; $field='id,voice_file';
$where='download=0'; $where='record_down=0';
$down_data2=$rongRecord->getArr($field,$where); $down_data2=$rongRecord->getArr($field,$where);
if($down_data2) { if($down_data2) {
foreach ($down_data2 as $k => $v) { foreach ($down_data2 as $k => $v) {
$ids[] = $v['id']; $ids[] = $v['id'];
$down_url2 = explode('/', $v['mp3_url']); $down_url2 = explode('/', $v['voice_file']);
down_file($v['mp3_url'], ROOT_PATH . 'public' . DS . 'static' . DS . 'voice', array_pop($down_url2)); down_file($v['voice_file'], ROOT_PATH . 'public' . DS . 'static' . DS . 'voice', array_pop($down_url2));
} }
} }
$id_str=implode(',',$ids); $id_str=implode(',',$ids);
$update['download']=1; $update['record_down']=1;
$where=" id in($id_str)"; $where=" id in($id_str)";
$rongRecord->save($update,$where); $rongRecord->save($update,$where);
...@@ -142,17 +142,32 @@ class PrivacyNumber ...@@ -142,17 +142,32 @@ class PrivacyNumber
$params = Request::instance()->param(); $params = Request::instance()->param();
/*搜索A经纪人agent_id and B客户 user_id */ /*搜索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']; $phone_a=$params['callerNum'];
if ($phone_a) { if ($phone_a) {
$agents_id = Db::table('agents')->where("phone='{$phone_a}' AND password IS NOT NULL")->value('id'); $agents_id = Db::table('agents')->where("phone='{$phone_a}' AND password IS NOT NULL")->value('id');
if (empty($agents_id)) { if (empty($agents_id)) {
$agents_id = Db::table('a_agents_phone')->where('phone',$phone_a)->value('agents_id'); $agents_id = Db::table('a_agents_phone')->where('phone',$phone_a)->value('agents_id');
} }
$params['agents_id'] = $agents_id; $date['agents_id'] = $agents_id;
$params['users_id'] = Db::table('u_users')->where('user_phone',$phone_a)->value('id'); $date['users_id'] = Db::table('u_users')->where('user_phone',$phone_a)->value('id');
} }
$report = new RongBilledInform(); $report = new SecretReport();
$report->allowField(true)->save($params); $report->allowField(true)->save($date);
$str=date('Y-m-d h:i:s').' 容联云话单'.var_export($params,true); $str=date('Y-m-d h:i:s').' 容联云话单'.var_export($params,true);
...@@ -163,9 +178,9 @@ class PrivacyNumber ...@@ -163,9 +178,9 @@ class PrivacyNumber
//录音通知 //录音通知
public function rongRecordingInformUrl(){ public function rongRecordingInformUrl(){
$params = Request::instance()->param(); $params = Request::instance()->param();
$report = new RongBilledInform(); $report = new SecretReport();
$where['callId']=$params['callId']; $where['call_id']=$params['callId'];
$update['mp3_url']=$params['recordUrl']; $update['voice_file']=$params['recordUrl'];
$report->save($update,$where); $report->save($update,$where);
$str=date('Y-m-d h:i:s').' 容联云录音'.var_export($params,true); $str=date('Y-m-d h:i:s').' 容联云录音'.var_export($params,true);
Log::write($str,'rongRecordingInformUrl'); //记录日志 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