From 43648d633414a0d81152f6c4431d344dc801245f Mon Sep 17 00:00:00 2001 From: zengchaoxin Date: Fri, 18 Oct 2019 10:25:51 +0800 Subject: [PATCH] test1 --- frontend/controllers/PhoneController.php | 50 ++++++++++++++++-------- 1 file changed, 33 insertions(+), 17 deletions(-) diff --git a/frontend/controllers/PhoneController.php b/frontend/controllers/PhoneController.php index 9f15abb..37dbfd7 100644 --- a/frontend/controllers/PhoneController.php +++ b/frontend/controllers/PhoneController.php @@ -278,7 +278,7 @@ class PhoneController extends \yii\web\Controller //$b = new GiftCreateImageErrorT(); $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(); $assign = NetworkPhoneAssignT::findOne(['phone'=>$caller,'is_phone'=>1]); @@ -294,8 +294,6 @@ class PhoneController extends \yii\web\Controller if($assign1){ $user_id = $assign1->user_id; $is_called = 1; - } else { - return json_encode(['code' => 400,'message' => "失败"]); } } $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); $end_time = date('Y-m-d H:i:s',time()-900); - $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(); -// $b->error = 222; -// $b->save(); + $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 = ''; @@ -368,14 +364,34 @@ class PhoneController extends \yii\web\Controller } } -// $b->error = 333; -// $b->save(); -// if($res){ 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) {