曾超新 5 years ago
parent a3e012698b
commit 43648d6334
  1. 50
      frontend/controllers/PhoneController.php

@ -278,7 +278,7 @@ class PhoneController extends \yii\web\Controller
//$b = new GiftCreateImageErrorT(); //$b = new GiftCreateImageErrorT();
$network_phone = NetworkPhoneT::findOne(['recorder_id'=>$recorder_id,'caller'=>$caller,'called'=>$called,'caller_show'=>$caller_show]); $network_phone = NetworkPhoneT::findOne(['recorder_id'=>$recorder_id,'caller'=>$caller,'called'=>$called,'caller_show'=>$caller_show]);
if((!$recorder_id&&!$caller&&!$called&&!$caller_show) || !$network_phone){ if(!$network_phone){
$network_phone = new NetworkPhoneT(); $network_phone = new NetworkPhoneT();
$assign = NetworkPhoneAssignT::findOne(['phone'=>$caller,'is_phone'=>1]); $assign = NetworkPhoneAssignT::findOne(['phone'=>$caller,'is_phone'=>1]);
@ -294,8 +294,6 @@ class PhoneController extends \yii\web\Controller
if($assign1){ if($assign1){
$user_id = $assign1->user_id; $user_id = $assign1->user_id;
$is_called = 1; $is_called = 1;
} else {
return json_encode(['code' => 400,'message' => "失败"]);
} }
} }
$network_phone->user_id=$user_id; $network_phone->user_id=$user_id;
@ -341,14 +339,12 @@ class PhoneController extends \yii\web\Controller
$begin_time = date('Y-m-d H:i:s',time()-10*24*3600); $begin_time = date('Y-m-d H:i:s',time()-10*24*3600);
$end_time = date('Y-m-d H:i:s',time()-900); $end_time = date('Y-m-d H:i:s',time()-900);
$phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"') $phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"')
->andWhere('release_time<="'.$end_time.'"') ->andWhere('release_time<="'.$end_time.'"')
->andWhere('call_result="ANSWERED"') ->andWhere('call_result="ANSWERED"')
->andWhere('record_file_url is null or record_file_url = ""') ->andWhere('record_file_url is null or record_file_url = ""')
->andWhere('record_file_url_real is not null or record_file_url_real <> ""') ->andWhere('record_file_url_real is not null or record_file_url_real <> ""')
->all(); ->all();
// $b->error = 222;
// $b->save();
foreach ($phone_items as $item) { foreach ($phone_items as $item) {
if ($item->record_file_url == '') { if ($item->record_file_url == '') {
$url = ''; $url = '';
@ -368,14 +364,34 @@ class PhoneController extends \yii\web\Controller
} }
} }
// $b->error = 333;
// $b->save();
// if($res){
return json_encode(['code' => 0,'message' => "成功"]); return json_encode(['code' => 0,'message' => "成功"]);
// }else{
// return ['code' => 400,'message' => "失败",];
// }
$phone_items = NetworkPhoneT::find()->where('release_time>="'.$begin_time.'"')
->andWhere('release_time<="'.$end_time.'"')
->andWhere('call_result="ANSWERED"')
->andWhere('record_file_url is null or record_file_url = ""')
->andWhere('record_file_url_real is not null or record_file_url_real <> ""')
->all();
foreach ($phone_items as $item) {
if ($item->record_file_url == '') {
$url = '';
if ($item->record_file_url_real != '') {
$url = $this->phoneMp3($item->record_file_url_real);
}
if ($url != '') {
$item->record_file_url = $url;
$item->save(false);
}
}
}
return json_encode(['code' => 0,'message' => "成功"]);
} }
function phoneMp3Bak($url) { function phoneMp3Bak($url) {

Loading…
Cancel
Save