You've already forked lubo_comment_query
新建节目时,自动修复时间,取消手动修复,取消主动修改分P
This commit is contained in:
@ -112,7 +112,6 @@ class ProgramConstructController extends BaseController
|
||||
$video_pivot->video_bvid = $bvid;
|
||||
$video_pivot->start_part = $match["part"];
|
||||
$video_pivot->start_time = $time;
|
||||
$video_pivot->stop_part = $match["part"];
|
||||
$program->save();
|
||||
$program->video_pivots()->save($video_pivot);
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ class ProgramVideoConstructController extends BaseController
|
||||
"stop_part" => ["required", "int", "gte:start_part"],
|
||||
"start_time" => ["required", "date_format:H:i:s"],
|
||||
"stop_time" => ["required", "date_format:H:i:s"],
|
||||
"created_at" => ["date"],
|
||||
]);
|
||||
$program_video = new ProgramVideos();
|
||||
$createPayload = $request->only(["start_part", "start_time", "stop_part", "stop_time"]);
|
||||
@ -54,6 +53,7 @@ class ProgramVideoConstructController extends BaseController
|
||||
$program_video->created_at = $request->post("created_at");
|
||||
}
|
||||
$program->video_pivots()->save($program_video);
|
||||
ProgramVideoUtil::fix_created_at_by_part_info($program_video->video_bvid);
|
||||
return redirect(route("program.construct.video.list", [
|
||||
"program"=>$program_video->program_id
|
||||
]));
|
||||
|
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property \Carbon\Carbon $duration
|
||||
* @property int $part_num
|
||||
*/
|
||||
class VideoParts extends Model
|
||||
{
|
||||
|
@ -80,10 +80,15 @@ class ProgramVideoUtil
|
||||
$base_time,
|
||||
$start_time->secondsSinceMidnight()
|
||||
);
|
||||
if ($cur_part->duration->diffInMinutes($start_time) < 20) {
|
||||
$program_video->stop_part += 1;
|
||||
if ($program_video->stop_part > $video_parts->pluck("part_num")->max()) {
|
||||
$program_video->stop_part = $video_parts->pluck("part_num")->max();
|
||||
if (!$program_video->stop_part) {
|
||||
// 没有再去修复
|
||||
if ($cur_part->duration->diffInMinutes($start_time) < 20) {
|
||||
$program_video->stop_part = $cur_part->part_num + 1;
|
||||
if ($program_video->stop_part > $video_parts->pluck("part_num")->max()) {
|
||||
$program_video->stop_part = $video_parts->pluck("part_num")->max();
|
||||
}
|
||||
} else {
|
||||
$program_video->stop_part = $cur_part->part_num;
|
||||
}
|
||||
}
|
||||
$program_video->save();
|
||||
|
Reference in New Issue
Block a user