|
|
@@ -323,7 +323,7 @@ class AIVideoGenerationService
|
|
|
logDB('generate', 'info', '即梦AI视频生成任务成功', ['id' => $task->id, 'result_url' => $statusInfo['result_url']]);
|
|
|
$task->updateStatus(MpGenerateVideoTask::STATUS_SUCCESS, $statusInfo);
|
|
|
|
|
|
- // 同步调整分镜视频状态和结果(兼容片段模式)
|
|
|
+ // 同步调整分镜视频状态和结果(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id && isset($statusInfo['result_url'])) {
|
|
|
try {
|
|
|
@@ -372,7 +372,7 @@ class AIVideoGenerationService
|
|
|
logDB('generate', 'error', '即梦AI视频生成任务失败', ['id' => $task->id, 'error' => $statusInfo['error_message']]);
|
|
|
$task->updateStatus(MpGenerateVideoTask::STATUS_FAILED, $statusInfo);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -391,7 +391,7 @@ class AIVideoGenerationService
|
|
|
'error_message' => '任务处理超时(超过12小时)'
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -587,7 +587,7 @@ class AIVideoGenerationService
|
|
|
logDB('generate', 'info', 'Seedance视频生成任务成功', ['id' => $task->id, 'result_url' => $statusInfo['result_url']]);
|
|
|
$task->updateStatus(MpGenerateVideoTask::STATUS_SUCCESS, $statusInfo);
|
|
|
|
|
|
- // 同步调整分镜视频状态和结果(兼容片段模式)
|
|
|
+ // 同步调整分镜视频状态和结果(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id && isset($statusInfo['result_url'])) {
|
|
|
try {
|
|
|
@@ -611,7 +611,7 @@ class AIVideoGenerationService
|
|
|
$segmentUpdateData['video_duration'] = $statusInfo['video_duration'];
|
|
|
$segmentUpdateData['video_time_point_start'] = 0;
|
|
|
|
|
|
- // 获取video_time_point_end(兼容片段模式)
|
|
|
+ // 获取video_time_point_end(兼容全能模式)
|
|
|
$audio_duration = $this->getAudioDuration($task, $segment_id, $statusInfo['video_duration'] ?? null);
|
|
|
$segmentUpdateData['video_time_point_end'] = $audio_duration ?? 0;
|
|
|
}
|
|
|
@@ -640,7 +640,7 @@ class AIVideoGenerationService
|
|
|
'result_json' => $statusInfo['result_json'] ?? []
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -659,7 +659,7 @@ class AIVideoGenerationService
|
|
|
'error_message' => '任务处理超时(超过48小时)'
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -1474,7 +1474,7 @@ class AIVideoGenerationService
|
|
|
logDB('generate', 'info', '可灵AI Omni视频生成任务成功', ['id' => $task->id, 'result_url' => $statusInfo['result_url']]);
|
|
|
$task->updateStatus(MpGenerateVideoTask::STATUS_SUCCESS, $statusInfo);
|
|
|
|
|
|
- // 同步调整分镜视频状态和结果(兼容片段模式)
|
|
|
+ // 同步调整分镜视频状态和结果(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id && isset($statusInfo['result_url'])) {
|
|
|
try {
|
|
|
@@ -1498,7 +1498,7 @@ class AIVideoGenerationService
|
|
|
$segmentUpdateData['video_duration'] = $statusInfo['video_duration'];
|
|
|
$segmentUpdateData['video_time_point_start'] = 0;
|
|
|
|
|
|
- // 获取video_time_point_end(兼容片段模式)
|
|
|
+ // 获取video_time_point_end(兼容全能模式)
|
|
|
$audio_duration = $this->getAudioDuration($task, $segment_id, $statusInfo['video_duration']);
|
|
|
$segmentUpdateData['video_time_point_end'] = $audio_duration ?? 0;
|
|
|
}
|
|
|
@@ -1526,7 +1526,7 @@ class AIVideoGenerationService
|
|
|
'result_json' => $statusInfo['result_json'] ?? []
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -1545,7 +1545,7 @@ class AIVideoGenerationService
|
|
|
'error_message' => '任务处理超时(超过24小时)'
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -2030,7 +2030,7 @@ class AIVideoGenerationService
|
|
|
/**
|
|
|
* 根据task获取segment_id或act_id(兼容act模式)
|
|
|
* 分镜模式:返回segment_id用于查询
|
|
|
- * 片段模式:返回act_id用于查询(因为segment_id为空)
|
|
|
+ * 全能模式:返回act_id用于查询(因为segment_id为空)
|
|
|
*/
|
|
|
private function getSegmentIdFromTask($task)
|
|
|
{
|
|
|
@@ -2041,7 +2041,7 @@ class AIVideoGenerationService
|
|
|
return $segment_id;
|
|
|
}
|
|
|
|
|
|
- // 如果有alias_act_id,返回act_id(片段模式,segment_id为空)
|
|
|
+ // 如果有alias_act_id,返回act_id(全能模式,segment_id为空)
|
|
|
$act_id = getProp($task, 'alias_act_id');
|
|
|
if ($act_id) {
|
|
|
return $act_id; // 直接返回act_id,不需要查segment_id
|
|
|
@@ -2053,7 +2053,7 @@ class AIVideoGenerationService
|
|
|
/**
|
|
|
* 更新分镜表(兼容act模式)
|
|
|
* 分镜模式:使用segment_id字段更新
|
|
|
- * 片段模式:使用id字段更新
|
|
|
+ * 全能模式:使用id字段更新
|
|
|
*/
|
|
|
private function updateSegmentTable($task, $updateData)
|
|
|
{
|
|
|
@@ -2064,7 +2064,7 @@ class AIVideoGenerationService
|
|
|
// 分镜模式:使用segment_id更新
|
|
|
return DB::table('mp_episode_segments')->where('segment_id', $segment_id)->update($updateData);
|
|
|
} elseif ($act_id) {
|
|
|
- // 片段模式(全能模式):使用id更新
|
|
|
+ // 全能模式(全能模式):使用id更新
|
|
|
return DB::table('mp_episode_segments')->where('id', $act_id)->update($updateData);
|
|
|
}
|
|
|
|
|
|
@@ -2074,10 +2074,10 @@ class AIVideoGenerationService
|
|
|
/**
|
|
|
* 获取audio_duration(兼容act模式)
|
|
|
* 分镜模式:使用segment_id查询
|
|
|
- * 片段模式:使用id查询
|
|
|
+ * 全能模式:使用id查询
|
|
|
* @param array $task 任务数据
|
|
|
* @param string|int $segmentIdOrActId segment_id或act_id
|
|
|
- * @param float|null $video_duration 视频时长(如果传入,片段模式直接返回此值)
|
|
|
+ * @param float|null $video_duration 视频时长(如果传入,全能模式直接返回此值)
|
|
|
* @return float
|
|
|
*/
|
|
|
private function getAudioDuration($task, $segmentIdOrActId, $video_duration = null)
|
|
|
@@ -2089,7 +2089,7 @@ class AIVideoGenerationService
|
|
|
// 分镜模式:使用segment_id查询
|
|
|
return DB::table('mp_episode_segments')->where('segment_id', $segmentIdOrActId)->value('audio_duration');
|
|
|
} elseif ($act_id) {
|
|
|
- // 片段模式(全能模式):如果传入了video_duration直接返回,否则查询audio_duration
|
|
|
+ // 全能模式(全能模式):如果传入了video_duration直接返回,否则查询audio_duration
|
|
|
if ($video_duration !== null && $video_duration > 0) {
|
|
|
return $video_duration;
|
|
|
}
|
|
|
@@ -2102,7 +2102,7 @@ class AIVideoGenerationService
|
|
|
/**
|
|
|
* 添加视频生成对话记录
|
|
|
* @param array $task 任务数据
|
|
|
- * @param string|int $segmentIdOrActId segment_id(分镜模式)或 act_id(片段模式)
|
|
|
+ * @param string|int $segmentIdOrActId segment_id(分镜模式)或 act_id(全能模式)
|
|
|
* @param string $videoUrl 视频URL
|
|
|
* @return void
|
|
|
*/
|
|
|
@@ -2119,7 +2119,7 @@ class AIVideoGenerationService
|
|
|
->select('b.user_id as uid', 'a.anime_id', 'a.episode_number', 'a.tail_frame', 'a.segment_id')
|
|
|
->first();
|
|
|
} elseif ($act_id) {
|
|
|
- // 片段模式:使用id查询
|
|
|
+ // 全能模式:使用id查询
|
|
|
$segment = DB::table('mp_episode_segments as a')->leftJoin('mp_animes as b', 'a.anime_id', 'b.id')
|
|
|
->where('a.id', $segmentIdOrActId)
|
|
|
->select('b.user_id as uid', 'a.anime_id', 'a.episode_number', 'a.tail_frame', 'a.segment_id', 'a.id')
|
|
|
@@ -2142,7 +2142,7 @@ class AIVideoGenerationService
|
|
|
$recordField = 'segment_id';
|
|
|
$recordValue = $segmentIdOrActId;
|
|
|
} else {
|
|
|
- // 片段模式:保存act_id字段
|
|
|
+ // 全能模式:保存act_id字段
|
|
|
$recordField = 'act_id';
|
|
|
$recordValue = $segmentIdOrActId;
|
|
|
}
|
|
|
@@ -2517,7 +2517,7 @@ class AIVideoGenerationService
|
|
|
logDB('generate', 'info', '统一API视频生成任务成功', ['id' => $task->id, 'result_url' => $statusInfo['result_url']]);
|
|
|
$task->updateStatus(MpGenerateVideoTask::STATUS_SUCCESS, $statusInfo);
|
|
|
|
|
|
- // 同步调整分镜视频状态和结果(兼容片段模式)
|
|
|
+ // 同步调整分镜视频状态和结果(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id && isset($statusInfo['result_url'])) {
|
|
|
try {
|
|
|
@@ -2541,7 +2541,7 @@ class AIVideoGenerationService
|
|
|
$segmentUpdateData['video_duration'] = $statusInfo['video_duration'];
|
|
|
$segmentUpdateData['video_time_point_start'] = 0;
|
|
|
|
|
|
- // 获取audio_duration(兼容片段模式)
|
|
|
+ // 获取audio_duration(兼容全能模式)
|
|
|
$audio_duration = $this->getAudioDuration($task, $segment_id, $statusInfo['video_duration'] ?? null);
|
|
|
$segmentUpdateData['video_time_point_end'] = $audio_duration ?? 0;
|
|
|
}
|
|
|
@@ -2570,7 +2570,7 @@ class AIVideoGenerationService
|
|
|
'result_json' => $statusInfo['result_json'] ?? []
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|
|
|
@@ -2589,7 +2589,7 @@ class AIVideoGenerationService
|
|
|
'error_message' => '任务处理超时(超过48小时)'
|
|
|
]);
|
|
|
|
|
|
- // 同步更新分镜表状态为失败(兼容片段模式)
|
|
|
+ // 同步更新分镜表状态为失败(兼容全能模式)
|
|
|
$segment_id = $this->getSegmentIdFromTask($task);
|
|
|
if ($segment_id) {
|
|
|
$this->updateSegmentTable($task, [
|