|
@@ -136,6 +136,7 @@ class DistVideoController extends AdminDistController
|
|
|
{
|
|
|
return Form::make(new DistVideo(), function (Form $form) {
|
|
|
//$form->display('id');
|
|
|
+ $help = admin_trans_label('video_help');
|
|
|
$form->text('title')->required();
|
|
|
$form->select('category_id', admin_trans_label('category_name'))
|
|
|
->options(DistVideoCategory::selectOptions())
|
|
@@ -146,7 +147,8 @@ class DistVideoController extends AdminDistController
|
|
|
->accept(config('distributor.upload.oss_image.accept'))
|
|
|
->maxSize(config('distributor.upload.oss_image.max_size'))
|
|
|
->dir(config("distributor.upload.directory.image").'/video/'.date("Ymd"));//
|
|
|
- $form->url("video_url", admin_trans_label('video_url'))->required();
|
|
|
+ $form->text("video_url", admin_trans_label('video_url'))->required()
|
|
|
+ ->help('<a href="/help/youtube_url/index.html" target="_blank">'.$help.'</a>');
|
|
|
$form->editor('remark');
|
|
|
//SEO
|
|
|
$form->text('seo_title');
|
|
@@ -183,6 +185,14 @@ class DistVideoController extends AdminDistController
|
|
|
if ($form->seo_title == '') {
|
|
|
$form->seo_title = $form->title;
|
|
|
}
|
|
|
+ //替换youtube URL
|
|
|
+ if (strpos($form->video_url, '<iframe') !== false) {
|
|
|
+ // 使用正则表达式提取 src 属性的值
|
|
|
+ if (preg_match('/<iframe[^>]+src="([^"]+)"/', $form->video_url, $matches)) {
|
|
|
+ $src = $matches[1];
|
|
|
+ $form->video_url = $src;
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
});
|
|
|
}
|