From 81dabc3bafab5c0e5840510169541d0876802c44 Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Tue, 10 Oct 2023 15:23:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=AF=AD=E9=9F=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/controller/XunFeiController.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/app/api/controller/XunFeiController.php b/app/api/controller/XunFeiController.php index de7ecc47f..379a47087 100644 --- a/app/api/controller/XunFeiController.php +++ b/app/api/controller/XunFeiController.php @@ -243,21 +243,21 @@ class XunFeiController extends BaseApiController if(empty($text)){ return $this->fail('未上传文本参数'); } - $date = date('YmdHis', time()); - $file_name = $date . mt_rand(1000, 9999) . '.mp3'; - $dir = app()->getRootPath() . '/public/uploads/audio/' . date('Ymd'); + $file_name = date('YmdHis', time()) . mt_rand(1000, 9999) . '.mp3'; + $date_path = date('Ymd'); + $dir = app()->getRootPath() . '/public/uploads/audio/' . $date_path; if (!is_dir($dir)) { mkdir($dir, 0755, true); } $audioFile = $dir . '/' . $file_name; $business = [ - 'aue' => 'lame', //mp3格式 - 'vcn' => 'xiaoyan', //发音人 - 'auf' => 'audio/L16;rate=16000', //音频采样率 - 'speed' => 50, //语速 - 'volume'=> 100, //音量 - 'pitch' => 50, //音高 - 'tte' => 'UTF8' + 'aue' => 'lame', //mp3格式 + 'vcn' => 'xiaoyan', //发音人 + 'auf' => 'audio/L16;rate=16000', //音频采样率 + 'speed' => 50, //语速 + 'volume' => 100, //音量 + 'pitch' => 50, //音高 + 'tte' => 'UTF8' ]; try { $tts = new TtsClient($this->app_id, $this->api_key, $this->api_secret, $business); @@ -265,7 +265,7 @@ class XunFeiController extends BaseApiController } catch (\Exception $e) { return $this->fail($e->getMessage().''); } - return $this->data(['audio_file' => request()->domain() . '/uploads/audio/' . date('Ymd') . '/' . $file_name]); + return $this->data(['audio_file' => request()->domain() . '/uploads/audio/' . $date_path . '/' . $file_name]); } }