Pārlūkot izejas kodu

尝试修复视频url异常更新为同一数据的bug

lh 2 nedēļas atpakaļ
vecāks
revīzija
23a32c9688

+ 3 - 3
app/Console/Commands/CheckVideoGenerationTasksCommand.php

@@ -241,13 +241,13 @@ class CheckVideoGenerationTasksCommand extends Command
             $reference_images = getProp($task, 'ref_image_url');
             if (!$reference_images) $reference_images = json_encode([], 256);
             
-            if ($segment_id) {
+            if (!empty($segment_id)) {
                 // 分镜模式:使用segment_id查询
                 $segment = DB::table('mp_episode_segments as a')->leftJoin('mp_animes as b', 'a.anime_id', 'b.id')
                     ->where('a.segment_id', $segmentIdOrActId)
                     ->select('b.user_id as uid', 'a.anime_id', 'a.episode_number', 'a.tail_frame', 'a.segment_id')
                     ->first();
-            } elseif ($act_id) {
+            } elseif (!empty($act_id)) {
                 // 全能模式:使用id查询
                 $segment = DB::table('mp_episode_segments as a')->leftJoin('mp_animes as b', 'a.anime_id', 'b.id')
                     ->where('a.id', $segmentIdOrActId)
@@ -266,7 +266,7 @@ class CheckVideoGenerationTasksCommand extends Command
             $now = date('Y-m-d H:i:s');
             
             // 根据模式确定保存的字段和值
-            if ($segment_id) {
+            if (!empty($segment_id)) {
                 // 分镜模式:保存segment_id字段
                 $recordField = 'segment_id';
                 $recordValue = $segmentIdOrActId;

+ 10 - 10
app/Services/AIGeneration/AIVideoGenerationService.php

@@ -2068,13 +2068,13 @@ class AIVideoGenerationService
         $segment_id = getProp($task, 'alias_segment_id');
         
         // 如果有segment_id,直接返回(分镜模式)
-        if ($segment_id) {
+        if (!empty($segment_id)) {
             return $segment_id;
         }
         
         // 如果有alias_act_id,返回act_id(全能模式,segment_id为空)
         $act_id = getProp($task, 'alias_act_id');
-        if ($act_id) {
+        if (!empty($act_id)) {
             return $act_id; // 直接返回act_id,不需要查segment_id
         }
         
@@ -2091,10 +2091,10 @@ class AIVideoGenerationService
         $segment_id = getProp($task, 'alias_segment_id');
         $act_id = getProp($task, 'alias_act_id');
         
-        if ($segment_id) {
+        if (!empty($segment_id)) {
             // 分镜模式:使用segment_id更新
             return DB::table('mp_episode_segments')->where('segment_id', $segment_id)->update($updateData);
-        } elseif ($act_id) {
+        } elseif (!empty($act_id)) {
             // 全能模式(全能模式):使用id更新
             return DB::table('mp_episode_segments')->where('id', $act_id)->update($updateData);
         }
@@ -2116,11 +2116,11 @@ class AIVideoGenerationService
         $segment_id = getProp($task, 'alias_segment_id');
         $act_id = getProp($task, 'alias_act_id');
         
-        if ($segment_id) {
+        if (!empty($segment_id)) {
             // 分镜模式:使用segment_id查询
             return DB::table('mp_episode_segments')->where('segment_id', $segmentIdOrActId)->value('audio_duration');
-        } elseif ($act_id) {
-            // 全能模式(全能模式):如果传入了video_duration直接返回,否则查询audio_duration
+        } elseif (!empty($act_id)) {
+            // 全能模式:如果传入了video_duration直接返回,否则查询audio_duration
             if ($video_duration !== null && $video_duration > 0) {
                 return $video_duration;
             }
@@ -2145,13 +2145,13 @@ class AIVideoGenerationService
             $reference_images = getProp($task, 'ref_image_url');
             if (!$reference_images) $reference_images = json_encode([], 256);
             
-            if ($segment_id) {
+            if (!empty($segment_id)) {
                 // 分镜模式:使用segment_id查询
                 $segment = DB::table('mp_episode_segments as a')->leftJoin('mp_animes as b', 'a.anime_id', 'b.id')
                     ->where('a.segment_id', $segmentIdOrActId)
                     ->select('b.user_id as uid', 'a.anime_id', 'a.episode_number', 'a.tail_frame', 'a.segment_id')
                     ->first();
-            } elseif ($act_id) {
+            } elseif (!empty($act_id)) {
                 // 全能模式:使用id查询
                 $segment = DB::table('mp_episode_segments as a')->leftJoin('mp_animes as b', 'a.anime_id', 'b.id')
                     ->where('a.id', $segmentIdOrActId)
@@ -2170,7 +2170,7 @@ class AIVideoGenerationService
             $now = date('Y-m-d H:i:s');
             
             // 根据模式确定保存的字段和值
-            if ($segment_id) {
+            if (!empty($segment_id)) {
                 // 分镜模式:保存segment_id字段
                 $recordField = 'segment_id';
                 $recordValue = $segmentIdOrActId;