自动修复逻辑,对应按钮

This commit is contained in:
Jerry Yan 2022-08-25 10:07:46 +08:00
parent 9fb8a83fa5
commit 712244e0a3
Signed by: q792602257
GPG Key ID: D070F653AF6C0004
6 changed files with 68 additions and 7 deletions

View File

@ -108,7 +108,7 @@ class ProgramConstructController extends BaseController
"content" => $e->getMessage() "content" => $e->getMessage()
]); ]);
} }
ProgramVideoUtil::fix_created_at_by_part_info($bvid); ProgramVideoUtil::fix_created_at_by_part_info($bvid, true);
return redirect(route("program.construct.list")); return redirect(route("program.construct.list"));
} }

View File

@ -107,7 +107,7 @@ class ProgramVideoConstructController extends BaseController
"id" => "没有开始时间,请先保存对应时间" "id" => "没有开始时间,请先保存对应时间"
]); ]);
} }
return view("program.construct.video.time_fix", [ return view("program.construct.video.manual_fix", [
"program_video" => $program_video "program_video" => $program_video
]); ]);
} }
@ -127,4 +127,16 @@ class ProgramVideoConstructController extends BaseController
ProgramVideoUtil::fix_created_at_by_manual($program_video, $each_time_sec); ProgramVideoUtil::fix_created_at_by_manual($program_video, $each_time_sec);
return redirect(route("program.construct.list")); return redirect(route("program.construct.list"));
} }
public function auto_fix_created_at(Request $request, string $bvid)
{
$result = ProgramVideoUtil::fix_created_at_by_part_info($bvid, true);
if ($result) {
return redirect(route("program.construct.list"));
} else {
return back()->withErrors([
"video_bvid" => "自动修复失败"
]);
}
}
} }

View File

@ -86,6 +86,7 @@ class ProgramVideoUtil
$program_video->stop_part = $video_parts->pluck("part_num")->max(); $program_video->stop_part = $video_parts->pluck("part_num")->max();
} }
} }
$program_video->save();
} }
} }
DB::commit(); DB::commit();

View File

@ -51,7 +51,7 @@
<div class="block my-2 text-center"> <div class="block my-2 text-center">
<input class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" type="submit"> <input class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" type="submit">
</div> </div>
@if($program_video->video_bvid) @if($program_video->video)
<div class="block my-2"> <div class="block my-2">
<a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" target="_blank" <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" target="_blank"
href="https://www.bilibili.com/video/{{$program_video->video_bvid}}?p={{$program_video->start_part}}&t={{$program_video->start_sec}}" href="https://www.bilibili.com/video/{{$program_video->video_bvid}}?p={{$program_video->start_part}}&t={{$program_video->start_sec}}"
@ -61,9 +61,16 @@
href="https://www.bilibili.com/video/{{$program_video->video_bvid}}?p={{$program_video->stop_part}}&t={{$program_video->stop_sec}}" 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}}" title="P{{$program_video->stop_part}}#{{$program_video->stop_time}}"
>打开至结束位置</a> >打开至结束位置</a>
@if($program_video->created_at)
<a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white"
href="{{ url(route("program.construct.video.batch_fix_created_at", ["program_video" => $program_video->id])) }}" href="{{ url(route("program.construct.video.manual_fix_created_at.view", ["program_video" => $program_video->id])) }}"
>去批量修复开打时间</a> >手动修复开打时间</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])) }}"
>自动修复</a>
@endif
</div> </div>
@endif @endif
</form> </form>

View File

@ -0,0 +1,40 @@
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>录播节目关联视频位置修改</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="{{ mix('/css/app.css') }}" rel="stylesheet"/>
</head>
<body>
@include("common.header")
<form class="w-full lg:w-1/2 lg:ml-6 border-2" action="" method="post" enctype="multipart/form-data">
<div class="text-lg font-bold">时间基准信息</div>
<input type="hidden" name="id" value="{{$program_video->id}}">
<label class="block my-2">
BVID
<input class="form-input border-0 border-b-2 w-full" disabled type="text" name="video_bvid" value="{{ $program_video->video_bvid }}">
</label>
<label class="block my-2">
开始P数
<input class="form-input border-0 border-b-2 w-full" disabled type="number" name="start_part" value="{{ $program_video->start_part }}">
</label>
<label class="block my-2">
开始时间
<input class="form-input border-0 border-b-2 w-full" disabled step="1" type="time" name="start_time" value="{{ $program_video->start_time }}">
</label>
<label class="block my-2">
节目开打时间
<input class="form-input border-0 border-b-2 w-full" disabled type="datetime-local" step="1" name="created_at" value="{{ $program_video->created_at }}">
</label>
<label class="block my-2">
每P时间
<input class="form-input border-0 border-b-2 w-full" type="time" step="1" name="each_time" value="{{ old("each_time") }}">
</label>
@include("common.form_error")
<div class="block my-2 text-center">
<input class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" type="submit" value="修复该录播下的所有节目开始时间">
</div>
</form>
@include("common.footer")
</body>
</html>

View File

@ -48,8 +48,9 @@ Route::prefix("/programs/construct")->middleware("auth:web")->group(function (Ro
$router->post("/{program}/video/add", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","create"])->name("program.construct.video.create"); $router->post("/{program}/video/add", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","create"])->name("program.construct.video.create");
$router->get("/video/{program_video}", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","edit"])->name("program.construct.video.edit"); $router->get("/video/{program_video}", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","edit"])->name("program.construct.video.edit");
$router->post("/video/{program_video}", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","submit"])->name("program.construct.video.submit"); $router->post("/video/{program_video}", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","submit"])->name("program.construct.video.submit");
$router->get("/video/{program_video}/batch_fix", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","to_fix_created_at"])->name("program.construct.video.batch_fix_created_at"); $router->get("/video/{program_video}/manual_fix", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","to_fix_created_at"])->name("program.construct.video.manual_fix_created_at.view");
$router->post("/video/{program_video}/batch_fix", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","fix_created_at_base_on"])->name("program.construct.video.batch_fix_created_at.submit"); $router->post("/video/{program_video}/manual_fix", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","fix_created_at_base_on"])->name("program.construct.video.manual_fix_created_at");
$router->get("/video/fix/{bvid}", ["\\App\\Http\\Controllers\\ProgramVideoConstructController","auto_fix_created_at"])->name("program.construct.video.auto_fix_created_at");
// 节目关联点播建设 // 节目关联点播建设
$router->get('/{program}/append', ["\\App\\Http\\Controllers\\ProgramAppendConstructController","index"])->name("program.construct.append.list"); $router->get('/{program}/append', ["\\App\\Http\\Controllers\\ProgramAppendConstructController","index"])->name("program.construct.append.list");
$router->get('/{program}/append/add', ["\\App\\Http\\Controllers\\ProgramAppendConstructController","add"])->name("program.construct.append.add"); $router->get('/{program}/append/add', ["\\App\\Http\\Controllers\\ProgramAppendConstructController","add"])->name("program.construct.append.add");