|
@@ -8,6 +8,7 @@ use App\Models\AIElement;
|
|
|
use App\Services\VolcEngineService;
|
|
use App\Services\VolcEngineService;
|
|
|
use GuzzleHttp\Client;
|
|
use GuzzleHttp\Client;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
+use Illuminate\Support\Facades\Redis;
|
|
|
|
|
|
|
|
class AIVideoGenerationService
|
|
class AIVideoGenerationService
|
|
|
{
|
|
{
|
|
@@ -2600,7 +2601,34 @@ class AIVideoGenerationService
|
|
|
// 添加视频生成对话记录
|
|
// 添加视频生成对话记录
|
|
|
$this->addVideoGenerationRecords($task, $segment_id, $statusInfo['result_url']);
|
|
$this->addVideoGenerationRecords($task, $segment_id, $statusInfo['result_url']);
|
|
|
|
|
|
|
|
|
|
+ // 如果是全能模式的首帧图,则提取视频第一帧并更新anime表
|
|
|
|
|
+ $act_id = getProp($task, 'alias_act_id');
|
|
|
|
|
+ if (!empty($act_id) && Redis::sismember('anime_act_first_frame_urls', $act_id)) {
|
|
|
|
|
+ $anime_id = DB::table('mp_episode_segments')->where('id', $act_id)->value('anime_id');
|
|
|
|
|
+ if ($anime_id) {
|
|
|
|
|
+ // 提取视频第一帧
|
|
|
|
|
+ $videoUrl = $segmentUpdateData['video_url'];
|
|
|
|
|
+ $firstFrameUrl = getVideoFirstFrame($videoUrl, 'anime_first_frames', 'tos');
|
|
|
|
|
+
|
|
|
|
|
+ if ($firstFrameUrl) {
|
|
|
|
|
+ // 更新anime表
|
|
|
|
|
+ DB::table('mp_animes')->where('id', $anime_id)->update([
|
|
|
|
|
+ 'first_frame_url' => $firstFrameUrl,
|
|
|
|
|
+ 'updated_at' => date('Y-m-d H:i:s')
|
|
|
|
|
+ ]);
|
|
|
|
|
+
|
|
|
|
|
+ dLog('video_frame')->info('全能模式首帧图更新成功', [
|
|
|
|
|
+ 'act_id' => $act_id,
|
|
|
|
|
+ 'anime_id' => $anime_id,
|
|
|
|
|
+ 'first_frame_url' => $firstFrameUrl
|
|
|
|
|
+ ]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
DB::commit();
|
|
DB::commit();
|
|
|
|
|
+ // 从Redis中移除
|
|
|
|
|
+ Redis::srem('anime_act_first_frame_urls', $act_id);
|
|
|
|
|
|
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
|
DB::rollBack();
|
|
DB::rollBack();
|