From 9f8f6804da8b4f60a851f029248efb88e8e8c13f Mon Sep 17 00:00:00 2001 From: yaooo <272523191@qq.com> Date: Wed, 11 Oct 2023 17:25:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0iat=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 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/api/controller/XunFeiController.php b/app/api/controller/XunFeiController.php index 6c978ef7e..6fa894a91 100644 --- a/app/api/controller/XunFeiController.php +++ b/app/api/controller/XunFeiController.php @@ -135,6 +135,7 @@ class XunFeiController extends BaseApiController } // 上传音频临时文件 $savename = \think\facade\Filesystem::putFile('audio', $file); + $file = app()->getRootPath() . '/runtime/storage/' . $savename; if (!file_exists($file)) { return $this->fail('未上传音频文件'); @@ -143,6 +144,11 @@ class XunFeiController extends BaseApiController if ($filesize > 1 * 1024 * 1024) { return $this->fail('录音文件太长'); } + $last_file_array = explode('\\', $savename); + $n = count($last_file_array) - 1; + $last_file = $last_file_array[$n]; + $copyFile = app()->getRootPath() . '/public/uploads/iat/' . $last_file; + copy($file, $copyFile); $ext = pathinfo($file, PATHINFO_EXTENSION); $extArray = ['mp3', 'pcm']; if (!in_array($ext, $extArray)) {