lh 2 weeks ago
parent
commit
a06ec073ca

+ 3 - 2
app/Http/Controllers/Anime/AnimeController.php

@@ -314,8 +314,8 @@ class AnimeController extends BaseController
                             'data' => [
                                 'task_id' => $task->id,
                                 'status' => $task->status,
-                                'result_url' => $task->result_url,
-                                'video_url' => $task->result_url, // 兼容字段
+                                'video_url' => $task->result_url,
+                                'last_frame_url' => $task->last_frame_url,
                                 'error_message' => $task->error_message
                             ]
                         ]) . "\n\n";
@@ -438,6 +438,7 @@ class AnimeController extends BaseController
                 // 构建视频生成参数
                 $videoParams = [
                     'model' => 'doubao-seedance-1-5-pro-251215',
+                    'alias_segment_id' => $segment->segment_id,
                     'prompt' => $fullPrompt,
                     'video_duration' => $videoDuration,
                     'video_resolution' => '720P',

+ 1 - 0
app/Models/MpGenerateVideoTask.php

@@ -31,6 +31,7 @@ class MpGenerateVideoTask extends Model
         'result_json',
         'api_type', // 新增:API类型标识(seedance_1_5_pro, jimeng_ai等)
         'last_frame_url', // 新增:尾帧图片URL(用于return_last_frame功能)
+        'alias_segment_id', // 新增:关联分镜ID
     ];
 
     protected $casts = [

+ 9 - 8
app/Services/AIGeneration/AIVideoGenerationService.php

@@ -330,6 +330,7 @@ class AIVideoGenerationService
         // 创建任务记录,复用现有表结构
         $task = MpGenerateVideoTask::create([
             'task_id' => $taskId,
+            'alias_segment_id' => $params['alias_segment_id'] ?? '',
             'prompt' => $params['prompt'] ?? '',
             'first_frame_url' => $params['first_frame_url'] ?? '',
             'tail_frame_url' => $params['tail_frame_url'] ?? '',
@@ -369,7 +370,7 @@ class AIVideoGenerationService
     private function submitSeedanceTaskToApi(MpGenerateVideoTask $task): void
     {
         $client = new Client(['verify'=>false,'timeout'=>120]);
-        // try {
+        try {
             // 验证环境变量配置
             $apiKey = env('VOLC_AI_API_KEY');
                 
@@ -463,13 +464,13 @@ class AIVideoGenerationService
                     'extra_params' => array_merge($task->extra_params, ['api_response' => $responseData])
                 ]);
             }
-        // } catch (\Exception $e) {
-        //     // 记录错误
-        //     $task->updateStatus(MpGenerateVideoTask::STATUS_FAILED, [
-        //         'error_message' => 'API请求失败: ' . $e->getMessage()
-        //     ]);
-        //     Utils::throwError('1001:'.$e->getMessage());
-        // }
+        } catch (\Exception $e) {
+            // 记录错误
+            $task->updateStatus(MpGenerateVideoTask::STATUS_FAILED, [
+                'error_message' => 'API请求失败: ' . $e->getMessage()
+            ]);
+            Utils::throwError('1001:'.$e->getMessage());
+        }
     }
 
     // 更新即梦AI视频任务状态

+ 1 - 0
app/Services/Anime/AnimeService.php

@@ -1438,6 +1438,7 @@ class AnimeService
         // 构建视频生成参数
         $videoParams = [
             'model' => 'doubao-seedance-1-5-pro-251215',
+            'alias_segment_id' => $segment_id,
             'prompt' => $fullPrompt,
             'video_duration' => $videoDuration,
             'video_resolution' => '720P',

+ 6 - 6
app/Services/DeepSeek/DeepSeekService.php

@@ -2044,7 +2044,7 @@ class DeepSeekService
             }
 
             // 保存对话记录
-            $recrods = [
+            $records = [
                 [
                     'uid'       => $uid,
                     'anime_id'  => $anime_id,
@@ -2068,7 +2068,7 @@ class DeepSeekService
                 ]
             ];
             // 保存对话记录
-            $boolen3 = DB::table('mp_anime_records')->insert($recrods);
+            $boolen3 = DB::table('mp_anime_records')->insert($records);
             if (!$boolen3) {
                 Utils::throwError('20003:对话记录保存失败');
             }
@@ -2447,7 +2447,7 @@ class DeepSeekService
             }
 
             // 保存对话记录
-            $recrods = [
+            $records = [
                 [
                     'uid'       => $uid,
                     'anime_id'  => $anime_id,
@@ -2468,7 +2468,7 @@ class DeepSeekService
                 ]
             ];
             // 保存对话记录
-            $boolen3 = DB::table('mp_anime_records')->insert($recrods);
+            $boolen3 = DB::table('mp_anime_records')->insert($records);
             if (!$boolen3) {
                 Utils::throwError('20003:对话记录保存失败');
             }
@@ -2946,7 +2946,7 @@ class DeepSeekService
                 $record_content .= "\n\n###上传内容\n" . $uploaded_content;
             }
 
-            $recrods = [
+            $records = [
                 [
                     'uid' => $uid,
                     'anime_id' => $anime_id,
@@ -2968,7 +2968,7 @@ class DeepSeekService
                     'updated_at' => $now
                 ]
             ];
-            $boolen4 = DB::table('mp_anime_records')->insert($recrods);
+            $boolen4 = DB::table('mp_anime_records')->insert($records);
             if (!$boolen4) {
                 Utils::throwError('20003:对话记录保存失败');
             }