|
|
@@ -60,6 +60,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
|
|
|
// 处理一个待生成的剧集;返回 1 表示处理失败,结束本次执行
|
|
|
$result = $this->processPendingEpisodeTask();
|
|
|
+ if ($result === -1) break;
|
|
|
}
|
|
|
|
|
|
return 0;
|
|
|
@@ -73,6 +74,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
private function processPendingEpisodeTask()
|
|
|
{
|
|
|
$anime_tasks = DB::table('mp_batch_episode_generation_details')->where('status', 'pending')->pluck('anime_id')->toArray();
|
|
|
+ if (!$anime_tasks) return -1;
|
|
|
foreach ($anime_tasks as $anime_id) {
|
|
|
dLog('command')->info("~~~~~~开始执行($anime_id)任务~~~~~~");
|
|
|
try {
|
|
|
@@ -85,7 +87,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
|
|
|
if (!$task) {
|
|
|
dLog('command')->info('[' . date('Y-m-d H:i:s') . '] 没有待处理的任务');
|
|
|
- return 0;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
dLog('command')->info('[' . date('Y-m-d H:i:s') . '] 找到待处理任务 - Anime ID: ' . $task->anime_id . ', Episode: ' . $task->episode_number);
|
|
|
@@ -102,7 +104,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
|
|
|
if ($prevTaskInBatch && $prevTaskInBatch->status !== 'completed') {
|
|
|
dLog('command')->info('[' . date('Y-m-d H:i:s') . '] 前一集(第' . $prevEpisodeNumber . '集)尚未完成,跳过当前任务');
|
|
|
- return 0;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
// 检查前一集是否已在系统中生成(查询 mp_anime_episodes)
|
|
|
@@ -124,7 +126,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
'updated_at' => now()
|
|
|
]);
|
|
|
|
|
|
- return 1;
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -147,7 +149,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
// 'updated_at' => now()
|
|
|
]);
|
|
|
|
|
|
- return 0;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
// 标记为处理中
|
|
|
@@ -200,7 +202,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
'error' => $result['error']
|
|
|
]);
|
|
|
|
|
|
- return 1;
|
|
|
+ continue;
|
|
|
}
|
|
|
|
|
|
// 标记为完成
|
|
|
@@ -215,7 +217,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
|
|
|
dLog('command')->info('[' . date('Y-m-d H:i:s') . '] 第' . $task->episode_number . '集生成成功');
|
|
|
|
|
|
- return 0;
|
|
|
+ continue;
|
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
dLog('command')->error('[' . date('Y-m-d H:i:s') . '] 生成失败: ' . $e->getMessage());
|
|
|
@@ -243,7 +245,7 @@ class ProcessBatchEpisodeGenerationCommand extends Command
|
|
|
]);
|
|
|
}
|
|
|
|
|
|
- return 1;
|
|
|
+ continue;
|
|
|
}
|
|
|
}
|
|
|
|