更新iat语音
This commit is contained in:
parent
7b9296039c
commit
9f8f6804da
@ -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)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user