支持直接从评论中一键生成节目

This commit is contained in:
Jerry Yan 2022-08-07 13:44:40 +08:00
parent 60a2ef15dc
commit b1124432c7
2 changed files with 19 additions and 1 deletions

View File

@ -10,9 +10,16 @@ class VideoQueryController extends BaseController
{ {
public function info(Request $request, Videos $video) public function info(Request $request, Videos $video)
{ {
$pivots = $video->program_pivots;
if (sizeof($pivots) === 0) {
$comment = $video->comments()->where("is_top", "=", 1)->first();
} else {
$comment = null;
}
return view("video.index", [ return view("video.index", [
"video" => $video, "video" => $video,
"video_pivots" => $video->program_pivots "video_pivots" => $pivots,
"comment" => $comment,
]); ]);
} }
} }

View File

@ -61,6 +61,17 @@
@endforeach @endforeach
</tbody> </tbody>
</table> </table>
@auth("web")
@if(sizeof($video_pivots) === 0 && $comment)
<form action="{{ url(route("program.construct.batch_create")) }}" method="post" enctype="multipart/form-data">
<input type="hidden" value="{{ $video->bvid }}" name="bvid">
<textarea name="content" class="hidden">{{ $comment->content }}</textarea>
<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>
@endif
@endauth
@include("common.footer") @include("common.footer")
</body> </body>
</html> </html>