|
@@ -20,7 +20,7 @@ class AnimeCheckImgUrlCommand extends Command
|
|
|
*
|
|
*
|
|
|
* @var string
|
|
* @var string
|
|
|
*/
|
|
*/
|
|
|
- protected $description = '检查动漫对话角色和场景图片生成状态';
|
|
|
|
|
|
|
+ protected $description = '检查动漫对话角色、场景和道具图片生成状态';
|
|
|
|
|
|
|
|
protected $aiImageGenerationService;
|
|
protected $aiImageGenerationService;
|
|
|
protected $DeepSeekService;
|
|
protected $DeepSeekService;
|
|
@@ -411,14 +411,16 @@ class AnimeCheckImgUrlCommand extends Command
|
|
|
dLog('command')->info('====================开始检查剧集====================');
|
|
dLog('command')->info('====================开始检查剧集====================');
|
|
|
|
|
|
|
|
// 获取待执行和执行中的剧集数据
|
|
// 获取待执行和执行中的剧集数据
|
|
|
- $data = DB::table('mp_anime_episodes')->whereIn('generate_status', ['待执行', '执行中'])->select('id', 'roles', 'scenes', 'generate_status')->get();
|
|
|
|
|
|
|
+ $data = DB::table('mp_anime_episodes')->whereIn('generate_status', ['待执行', '执行中'])->select('id', 'roles', 'scenes', 'props', 'generate_status')->get();
|
|
|
|
|
|
|
|
foreach ($data as $item) {
|
|
foreach ($data as $item) {
|
|
|
$id = getProp($item, 'id');
|
|
$id = getProp($item, 'id');
|
|
|
$roles = json_decode(getProp($item, 'roles'), true);
|
|
$roles = json_decode(getProp($item, 'roles'), true);
|
|
|
$scenes = json_decode(getProp($item, 'scenes'), true);
|
|
$scenes = json_decode(getProp($item, 'scenes'), true);
|
|
|
|
|
+ $props = json_decode(getProp($item, 'props'), true);
|
|
|
$role_count = count($roles);
|
|
$role_count = count($roles);
|
|
|
$scene_count = count($scenes);
|
|
$scene_count = count($scenes);
|
|
|
|
|
+ $prop_count = count($props);
|
|
|
$current_status = getProp($item, 'generate_status');
|
|
$current_status = getProp($item, 'generate_status');
|
|
|
|
|
|
|
|
// 如果状态是待执行,先改为执行中
|
|
// 如果状态是待执行,先改为执行中
|
|
@@ -437,7 +439,10 @@ class AnimeCheckImgUrlCommand extends Command
|
|
|
// 处理场景图片状态
|
|
// 处理场景图片状态
|
|
|
$scene_result = $this->checkEpisodeScenes($id, $scenes);
|
|
$scene_result = $this->checkEpisodeScenes($id, $scenes);
|
|
|
|
|
|
|
|
- if ($role_result['success_count'] == $role_count && $scene_result['success_count'] == $scene_count) {
|
|
|
|
|
|
|
+ // 处理道具图片状态
|
|
|
|
|
+ $prop_result = $this->checkEpisodeProps($id, $props);
|
|
|
|
|
+
|
|
|
|
|
+ if ($role_result['success_count'] == $role_count && $scene_result['success_count'] == $scene_count && $prop_result['success_count'] == $prop_count) {
|
|
|
// 更新状态为已完成
|
|
// 更新状态为已完成
|
|
|
DB::table('mp_anime_episodes')->where('id', $id)->update(['generate_status' => '已完成', 'updated_at'=>date('Y-m-d H:i:s')]);
|
|
DB::table('mp_anime_episodes')->where('id', $id)->update(['generate_status' => '已完成', 'updated_at'=>date('Y-m-d H:i:s')]);
|
|
|
dLog('command')->info("剧集ID:{$id} 图片已全部生成完毕,状态改为已完成");
|
|
dLog('command')->info("剧集ID:{$id} 图片已全部生成完毕,状态改为已完成");
|
|
@@ -513,4 +518,37 @@ class AnimeCheckImgUrlCommand extends Command
|
|
|
'success_count' => $scene_success_count,
|
|
'success_count' => $scene_success_count,
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 检查剧集道具(逻辑与角色/场景一致)
|
|
|
|
|
+ private function checkEpisodeProps($id, $props) {
|
|
|
|
|
+ $prop_success_count = 0;
|
|
|
|
|
+ foreach ($props as &$prop) {
|
|
|
|
|
+ $task_id = getProp($prop, 'task_id');
|
|
|
|
|
+ $task_status = getProp($prop, 'task_status');
|
|
|
|
|
+ if (!$task_id || in_array($task_status, ['success', 'failed'])) {
|
|
|
|
|
+ $prop_success_count++;
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+ $task = DB::table('mp_generate_pic_tasks')->where('id', $task_id)->select('result_url', 'status')->first();
|
|
|
|
|
+ $status = getProp($task, 'status');
|
|
|
|
|
+ if (in_array($status, ['success', 'failed'])) {
|
|
|
|
|
+ $prop['task_status'] = $status; // 使用实际的任务状态
|
|
|
|
|
+ $prop['url'] = '';
|
|
|
|
|
+ $result_url = getProp($task, 'result_url');
|
|
|
|
|
+ if ($result_url && is_json($result_url) && $status == 'success') {
|
|
|
|
|
+ $prop['url'] = json_decode($result_url, true)[0];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $prop_success_count++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($prop_success_count > 0) {
|
|
|
|
|
+ DB::table('mp_anime_episodes')->where('id', $id)->update(['props' => json_encode($props, 256)]);
|
|
|
|
|
+ }
|
|
|
|
|
+ return [
|
|
|
|
|
+ 'props' => $props,
|
|
|
|
|
+ 'success_count' => $prop_success_count,
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+}
|