|
@@ -13071,32 +13071,70 @@ Q版卡通风格,头大身小,造型圆润可爱,线条简单,色彩明
|
|
|
Utils::throwError('20003:保存失败,请重试');
|
|
Utils::throwError('20003:保存失败,请重试');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 查询保存后的所有片段记录
|
|
|
|
|
|
|
+ // 查询保存后的所有片段记录(数组化,与 episodeInfoForAce 处理一致)
|
|
|
$saved_segments = DB::table('mp_episode_segments')
|
|
$saved_segments = DB::table('mp_episode_segments')
|
|
|
->where('episode_id', $episode_id)
|
|
->where('episode_id', $episode_id)
|
|
|
->orderBy('act_number')
|
|
->orderBy('act_number')
|
|
|
- ->get();
|
|
|
|
|
|
|
+ ->get()
|
|
|
|
|
+ ->map(function ($value) {
|
|
|
|
|
+ return (array)$value;
|
|
|
|
|
+ })
|
|
|
|
|
+ ->toArray();
|
|
|
|
|
|
|
|
- $saved_acts = [];
|
|
|
|
|
- foreach ($saved_segments as $saved_segment) {
|
|
|
|
|
- $saved_acts[] = [
|
|
|
|
|
- 'act_id' => $saved_segment->id,
|
|
|
|
|
- 'act_number' => $saved_segment->act_number,
|
|
|
|
|
- 'act_duration' => $saved_segment->video_duration ? $saved_segment->video_duration : $saved_segment->act_duration,
|
|
|
|
|
- 'act_content' => $saved_segment->act_content,
|
|
|
|
|
- 'act_show_content' => $saved_segment->act_show_content,
|
|
|
|
|
- 'video_url' => $saved_segment->video_url ?? '',
|
|
|
|
|
- 'video_duration' => $saved_segment->video_duration ?? 0,
|
|
|
|
|
- 'video_time_point_start'=> $saved_segment->video_time_point_start ?? 0,
|
|
|
|
|
- 'video_time_point_end' => $saved_segment->video_time_point_end ?? 0,
|
|
|
|
|
|
|
+ // 构造与 episodeInfoForAce 一致的 acts 与 total_duration
|
|
|
|
|
+ $acts = [];
|
|
|
|
|
+ $totalDuration = 0;
|
|
|
|
|
+ foreach ($saved_segments as $segment) {
|
|
|
|
|
+ $videoDuration = getProp($segment, 'video_duration');
|
|
|
|
|
+ $actDuration = getProp($segment, 'act_duration');
|
|
|
|
|
+ if (!empty($videoDuration) && is_numeric($videoDuration)) {
|
|
|
|
|
+ $totalDuration += floatval($videoDuration);
|
|
|
|
|
+ } elseif (!empty($actDuration) && is_numeric($actDuration)) {
|
|
|
|
|
+ $totalDuration += floatval($actDuration);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $totalDuration += 5;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $acts[] = [
|
|
|
|
|
+ 'act_id' => getProp($segment, 'id'),
|
|
|
|
|
+ 'act_number' => getProp($segment, 'act_number'),
|
|
|
|
|
+ 'act_title' => getProp($segment, 'act_title'),
|
|
|
|
|
+ 'act_duration' => getProp($segment, 'act_duration'),
|
|
|
|
|
+ 'act_content' => getProp($segment, 'act_content'),
|
|
|
|
|
+ 'video_url' => getProp($segment, 'video_url'),
|
|
|
|
|
+ 'video_duration' => getProp($segment, 'video_duration', 0),
|
|
|
|
|
+ 'video_time_point_start' => getProp($segment, 'video_time_point_start', 0),
|
|
|
|
|
+ 'video_time_point_end' => getProp($segment, 'video_time_point_end', getProp($segment, 'video_duration', 0)),
|
|
|
|
|
+ 'last_frame_url' => getProp($segment, 'last_frame_url'),
|
|
|
|
|
+ 'current_type' => getProp($segment, 'current_type'),
|
|
|
];
|
|
];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- return [
|
|
|
|
|
- 'anime_id' => $anime_id,
|
|
|
|
|
- 'episode_id' => $episode_id,
|
|
|
|
|
- 'acts' => $saved_acts,
|
|
|
|
|
|
|
+ // 顶层与 episodeInfoForAce 一致
|
|
|
|
|
+ $result = [
|
|
|
|
|
+ 'episode_id' => $episode_id,
|
|
|
|
|
+ 'anime_id' => $anime_id,
|
|
|
|
|
+ 'episode_number' => $episode_number,
|
|
|
|
|
+ 'title' => getProp($episode, 'title'),
|
|
|
|
|
+ 'intro' => getProp($episode, 'intro'),
|
|
|
|
|
+ 'art_style' => getProp($episode, 'art_style'),
|
|
|
|
|
+ 'roles' => json_decode(getProp($episode, 'roles', '[]'), true),
|
|
|
|
|
+ 'scenes' => json_decode(getProp($episode, 'scenes', '[]'), true),
|
|
|
|
|
+ 'props' => getProp($episode, 'props') ? json_decode(getProp($episode, 'props'), true) : [],
|
|
|
|
|
+ 'is_generated' => getProp($episode, 'is_generated'),
|
|
|
|
|
+ 'acts' => array_values($acts),
|
|
|
|
|
+ 'total_duration' => intval(round($totalDuration)),
|
|
|
];
|
|
];
|
|
|
|
|
+
|
|
|
|
|
+ // video_params(从 mp_animes 取,与 episodeInfoForAce 一致)
|
|
|
|
|
+ $animeRow = DB::table('mp_animes')->where('id', $anime_id)->first(['video_model', 'video_resolution', 'video_ratio']);
|
|
|
|
|
+ $result['video_params'] = [
|
|
|
|
|
+ 'video_model' => getProp($animeRow, 'video_model'),
|
|
|
|
|
+ 'video_resolution' => getProp($animeRow, 'video_resolution'),
|
|
|
|
|
+ 'ratio' => getProp($animeRow, 'video_ratio'),
|
|
|
|
|
+ ];
|
|
|
|
|
+
|
|
|
|
|
+ return $result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|