Commit 20b1ca3f authored by hujun's avatar hujun

录音

parent 6e2d1296
...@@ -65,7 +65,7 @@ class SecretReport extends BaseModel ...@@ -65,7 +65,7 @@ class SecretReport extends BaseModel
} }
if ($v->voice_file) { if ($v->voice_file) {
$result[$k]['voice_file'] = 'http://192.168.0.22/static/voice/'.$v->voice_file; $result[$k]['voice_file'] = 'http://file.tonglianjituan.com/static/voice/'.$v->voice_file;
} else { } else {
$result[$k]['voice_file'] = ""; $result[$k]['voice_file'] = "";
} }
......
...@@ -75,22 +75,42 @@ class PrivacyNumber ...@@ -75,22 +75,42 @@ class PrivacyNumber
public function queryRecordFile() public function queryRecordFile()
{ {
set_time_limit(0); set_time_limit(0);
$param = Request::instance()->param();
if (empty($param['record_down']) && $param['record_down'] > 2) {
return json_encode([ 'code' => 101, 'msg' => '参数错误' ]);
}
if ($param['record_down'] == 1) {
$where['record_down'] = 0;
}
if ($param['record_down'] == 2) {
$where['record_down'] = 1;
}
$m_secret = new AliYunSecretReport(); $m_secret = new AliYunSecretReport();
$fields = 'id,call_id,call_time,voice_file,type'; $fields = 'id,call_id,call_time,voice_file,type,record_down';
$where['record_down'] = 0;
$where['time'] = [ '>', 0 ]; $where['time'] = [ '>', 0 ];
$where['type'] = [ '>', 0 ]; $where['type'] = [ '>', 0 ];
$down_data = $m_secret->secretReportAll($fields, $where); $down_data = $m_secret->secretReportAll($fields, $where);
$is_down = ''; $is_down = '';
foreach ($down_data as $k => $v) { foreach ($down_data as $k => $v) {
if ($v['type'] == 1) { if ($v['type'] == 1) {
/*阿里云音频下载*/ /*阿里云音频下载*/
$result_data = PlsDemo::queryRecordFileDownloadUrl($v['call_id'], $v['call_time']); $result_data = PlsDemo::queryRecordFileDownloadUrl($v['call_id'], $v['call_time']);
if (isset($result_data->Message) && $result_data->Message == 'OK') { if (isset($result_data->Message) && $result_data->Message == 'OK') {
$down_url = isset($result_data->DownloadUrl) ? explode('?', $result_data->DownloadUrl) : $result_data->DownloadUrl; $down_url = isset($result_data->DownloadUrl) ? explode('?', $result_data->DownloadUrl) : $result_data->DownloadUrl;
$is_down = down_file($result_data->DownloadUrl, PHONE_VOICE, basename($down_url[0]));
if ($param['record_down'] == 1) {
$file_name = basename($down_url[0]);
} else {
$file_name = pathinfo($v['voice_file']);
$file_name = $file_name['filename'];
}
$is_down = down_file($result_data->DownloadUrl, PHONE_VOICE, $file_name);
} }
} elseif ($v['type'] == 2) { } elseif ($v['type'] == 2) {
/*容联云音频下载*/ /*容联云音频下载*/
...@@ -98,8 +118,10 @@ class PrivacyNumber ...@@ -98,8 +118,10 @@ class PrivacyNumber
} }
if (file_exists($is_down)) { if (file_exists($is_down)) {
$data['record_down'] = 1; $data['record_down'] = empty($v['record_down']) ? 1 : 2;
$data['voice_file'] = date('Ymd') . '/' . basename($is_down); if ($data['record_down'] == 1) {
$data['voice_file'] = date('Ymd') . '/' . basename($is_down);
}
$m_secret->updateDownStatus($v['id'], $data); $m_secret->updateDownStatus($v['id'], $data);
} }
} }
......
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