Commit 01b9a2ad authored by zfc's avatar zfc

容联云回调2

parent 7cd4c24c
...@@ -75,7 +75,13 @@ class CellPhone extends Basic ...@@ -75,7 +75,13 @@ class CellPhone extends Basic
$Rong = new RongDemo(); $Rong = new RongDemo();
$record2 = empty($this->params['record']) ? 'true' : 'false'; /* 是否录音(容联云规定string类型)*/ $record2 = empty($this->params['record']) ? 'true' : 'false'; /* 是否录音(容联云规定string类型)*/
// var_dump($phone_x);/*************测试****************/ // var_dump($phone_x);/*************测试****************/
$result = $Rong->setNumber($phone_a, $phone_b, $phone_x['phone_x'], $phone_x['area'],$record2); /*计算有效期*/
if(empty($setting['day_num'])){
$yx_time=$setting['day_num']*60*60*24;
}else{
$yx_time=604800;
}
$result = $Rong->setNumber($phone_a, $phone_b, $phone_x['phone_x'], $phone_x['area'],$yx_time,$record2);
/*绑定成功*/ /*绑定成功*/
// var_dump($result);/*************测试****************/ // var_dump($result);/*************测试****************/
if($result['statusCode']=='000000'){ if($result['statusCode']=='000000'){
......
...@@ -129,9 +129,10 @@ class RongDemo ...@@ -129,9 +129,10 @@ class RongDemo
* @param $xNumber * @param $xNumber
* @param $areaCode * @param $areaCode
* @param $record * @param $record
* @param $yx_time
* @return string * @return string
*/ */
public function setNumber($aNumber,$bNumber,$xNumber,$areaCode,$record){ public function setNumber($aNumber,$bNumber,$xNumber,$areaCode,$yx_time='604800',$record){
$data = $this->components; $data = $this->components;
$time = date('YmdHis',time()); $time = date('YmdHis',time());
$sign = $this->sigParameter($time); /*签名*/ $sign = $this->sigParameter($time); /*签名*/
...@@ -145,6 +146,7 @@ class RongDemo ...@@ -145,6 +146,7 @@ class RongDemo
'servingNumber' => $xNumber, 'servingNumber' => $xNumber,
'areaCode' => $areaCode, 'areaCode' => $areaCode,
'needRecord' =>$record, 'needRecord' =>$record,
'mappingDuratio'=>$yx_time,
'cdrNotifyUrl' =>CURRENT_URL."task/rongBilledInformUrl", 'cdrNotifyUrl' =>CURRENT_URL."task/rongBilledInformUrl",
'callStateNotifyUrl'=>CURRENT_URL."task/rongStatusInformUrl", 'callStateNotifyUrl'=>CURRENT_URL."task/rongStatusInformUrl",
'recordNotifyUrl'=>CURRENT_URL."task/rongRecordingInformUrl", 'recordNotifyUrl'=>CURRENT_URL."task/rongRecordingInformUrl",
......
...@@ -22,4 +22,17 @@ class RongBilledInform extends BaseModel ...@@ -22,4 +22,17 @@ class RongBilledInform extends BaseModel
return $r; return $r;
} }
/**
* @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;
}
} }
\ No newline at end of file
...@@ -72,6 +72,23 @@ class PrivacyNumber ...@@ -72,6 +72,23 @@ class PrivacyNumber
} }
} }
} }
/*容联云音频下载*/
$rongRecord = new RongBilledInform();
$ids=array();
$field='id,mp3_url';
$where='download=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));
}
}
$id_str=implode(',',$ids);
$update['download']=1;
$where=" id in($id_str)";
$rongRecord->save($update,$where);
return ; return ;
} }
......
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