|
|
@@ -438,6 +438,7 @@ class DeepSeekService
|
|
|
// 最终合成前的参数组
|
|
|
$mp_chapter_paragraph_audios = [];
|
|
|
$sequence = 1;
|
|
|
+ $complete_paragraph_sequences = [];
|
|
|
foreach($words as &$word) {
|
|
|
if (!isset($word['text']) || !isset($word['emotion']) || !isset($word['voice_type']) || !isset($word['voice_name']) || !isset($word['speed_ratio']) || !isset($word['loudness_ratio']) || !isset($word['emotion_scale'])) Utils::throwError('20003:参数格式有误');
|
|
|
if (!($word['text']) || !($word['voice_type']) || !($word['voice_name'])) Utils::throwError('20003:参数不得为空');
|
|
|
@@ -470,13 +471,14 @@ class DeepSeekService
|
|
|
$paragraph = isset($paragraph_list[$sequence]) ? $paragraph_list[$sequence] : [];
|
|
|
// 如果音频存在并且参数都未改变则使用已生成的音频
|
|
|
if (getProp($paragraph, 'paragraph_audio_url')) {
|
|
|
- if (getProp($paragraph, 'role') == getProp($word, 'role') && getProp($paragraph, 'text') == getProp($word, 'text') &&
|
|
|
- getProp($paragraph, 'voice_type') == getProp($word, 'voice_type') &&
|
|
|
- getProp($paragraph, 'speed_ratio') == getProp($word, 'speed_ratio') && getProp($paragraph, 'loudness_ratio') == getProp($word, 'loudness_ratio') &&
|
|
|
- getProp($paragraph, 'emotion_scale') == getProp($word, 'emotion_scale'))
|
|
|
- {
|
|
|
- $word['paragraph_audio_url'] = getProp($paragraph, 'paragraph_audio_url');
|
|
|
- }
|
|
|
+ // if (getProp($paragraph, 'role') == getProp($word, 'role') && getProp($paragraph, 'text') == getProp($word, 'text') &&
|
|
|
+ // getProp($paragraph, 'voice_type') == getProp($word, 'voice_type') &&
|
|
|
+ // getProp($paragraph, 'speed_ratio') == getProp($word, 'speed_ratio') && getProp($paragraph, 'loudness_ratio') == getProp($word, 'loudness_ratio') &&
|
|
|
+ // getProp($paragraph, 'emotion_scale') == getProp($word, 'emotion_scale'))
|
|
|
+ // {
|
|
|
+ // $word['paragraph_audio_url'] = getProp($paragraph, 'paragraph_audio_url');
|
|
|
+ // }
|
|
|
+ $word['paragraph_audio_url'] = getProp($paragraph, 'paragraph_audio_url');
|
|
|
}
|
|
|
|
|
|
$tmp = $word;
|
|
|
@@ -498,6 +500,7 @@ class DeepSeekService
|
|
|
$tmp['updated_at'] = date('Y-m-d H:i:s');
|
|
|
if (!getProp($tmp, 'paragraph_audio_url')) Utils::throwError('20003:段落未生成音频,请等待完成后提交');
|
|
|
$mp_chapter_paragraph_audios[] = $tmp;
|
|
|
+ $complete_paragraph_sequences[] = $sequence;
|
|
|
|
|
|
$sequence++;
|
|
|
}
|
|
|
@@ -544,6 +547,11 @@ class DeepSeekService
|
|
|
Utils::throwError('20003:创建任务失败');
|
|
|
}
|
|
|
|
|
|
+ // 删除不在段落序号范围内的其他数据
|
|
|
+ if ($complete_paragraph_sequences) {
|
|
|
+ DB::table('mp_chapter_paragraph_audios')->where('bid', $bid)->where('version_id', $version_id)->where('cid', $cid)->whereNotIn('sequence', $complete_paragraph_sequences)->delete();
|
|
|
+ }
|
|
|
+
|
|
|
// // 删除章节分句音频数据并重新插入
|
|
|
// DB::table('mp_chapter_paragraph_audios')->where('bid', $bid)->where('version_id', $version_id)->where('cid', $cid)->delete();
|
|
|
// $boolen3 = DB::table('mp_chapter_paragraph_audios')->insert($mp_chapter_paragraph_audios);
|