更新语音

This commit is contained in:
yaooo 2023-10-10 15:23:52 +08:00
parent 1c1668173d
commit 81dabc3baf

View File

@ -243,9 +243,9 @@ 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);
}
@ -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]);
}
}