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,11 +80,16 @@ class ProgramVideoUtil | ||||
|                         $base_time, | ||||
|                         $start_time->secondsSinceMidnight() | ||||
|                     ); | ||||
|                     if (!$program_video->stop_part) { | ||||
|                         // 没有再去修复
 | ||||
|                         if ($cur_part->duration->diffInMinutes($start_time) < 20) { | ||||
|                         $program_video->stop_part += 1; | ||||
|                             $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(); | ||||
|                 } | ||||
|   | ||||
| @@ -28,10 +28,6 @@ | ||||
|         @endif | ||||
|         <input class="form-input border-0 border-b-2 w-full" type="file" name="start_image"> | ||||
|     </label> | ||||
|     <label class="block my-2"> | ||||
|         节目开打时间 | ||||
|         <input class="form-input border-0 border-b-2 w-full" type="datetime-local" step="1" name="created_at" value="{{ old("created_at", $program_video->created_at) }}"> | ||||
|     </label> | ||||
|     <label class="block my-2"> | ||||
|         结束P数 | ||||
|         <input class="form-input border-0 border-b-2 w-full" type="number" name="stop_part" value="{{ old("stop_part", $program_video->stop_part) }}"> | ||||
| @@ -61,11 +57,6 @@ | ||||
|            href="https://www.bilibili.com/video/{{$program_video->video_bvid}}?p={{$program_video->stop_part}}&t={{$program_video->stop_sec}}" | ||||
|            title="P{{$program_video->stop_part}}#{{$program_video->stop_time}}" | ||||
|         >打开至结束位置</a> | ||||
|         @if($program_video->created_at) | ||||
|         <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" | ||||
|            href="{{ url(route("program.construct.video.manual_fix_created_at.view", ["program_video" => $program_video->id])) }}" | ||||
|         >手动修复开打时间</a> | ||||
|         @endif | ||||
|         @if($program_video->video->parts()->count() > 0) | ||||
|         <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" | ||||
|            href="{{ url(route("program.construct.video.auto_fix_created_at", ["bvid" => $program_video->video_bvid])) }}" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user