|
@@ -57,7 +57,7 @@ class EditVideoMp4 extends Command |
|
@@ -57,7 +57,7 @@ class EditVideoMp4 extends Command |
|
57
|
$list = $templateModel->list(['id'=>1]);
|
57
|
$list = $templateModel->list(['id'=>1]);
|
|
58
|
foreach ($list as $k1 => $v1){
|
58
|
foreach ($list as $k1 => $v1){
|
|
59
|
echo date('Y-m-d H:i:s') . '更新的id:'.$v1['id'] . PHP_EOL;
|
59
|
echo date('Y-m-d H:i:s') . '更新的id:'.$v1['id'] . PHP_EOL;
|
|
60
|
- $this->getVideoSrc($v1['id'],$v1['main_html']);
|
60
|
+ $this->getVideoSrc($v1['id'],$v1['main_html'],'main_html');
|
|
61
|
}
|
61
|
}
|
|
62
|
return true;
|
62
|
return true;
|
|
63
|
}
|
63
|
}
|
|
@@ -69,9 +69,9 @@ class EditVideoMp4 extends Command |
|
@@ -69,9 +69,9 @@ class EditVideoMp4 extends Command |
|
69
|
* @method :post
|
69
|
* @method :post
|
|
70
|
* @time :2024/4/16 9:46
|
70
|
* @time :2024/4/16 9:46
|
|
71
|
*/
|
71
|
*/
|
|
72
|
- public function getVideoSrc($id,$html){
|
72
|
+ public function getVideoSrc($id,$html,$filed){
|
|
73
|
$main_html = $html;
|
73
|
$main_html = $html;
|
|
74
|
- $pattern = '/<img.*?src=[\'"]([^\'"]+)[\'"].*?>/i';
|
74
|
+ $pattern = '/<video.*?src="([^"]+)"[^>]*>/i';
|
|
75
|
preg_match_all($pattern, $html, $matches);
|
75
|
preg_match_all($pattern, $html, $matches);
|
|
76
|
$srcLinks = $matches[1];
|
76
|
$srcLinks = $matches[1];
|
|
77
|
foreach ($srcLinks as $link) {
|
77
|
foreach ($srcLinks as $link) {
|
|
@@ -79,7 +79,7 @@ class EditVideoMp4 extends Command |
|
@@ -79,7 +79,7 @@ class EditVideoMp4 extends Command |
|
79
|
$main_html = str_replace($link, $newLink, $main_html);
|
79
|
$main_html = str_replace($link, $newLink, $main_html);
|
|
80
|
}
|
80
|
}
|
|
81
|
$templateModel = new BTemplate();
|
81
|
$templateModel = new BTemplate();
|
|
82
|
- $templateModel->edit(['main_html'=>$main_html],['id'=>$id]);
|
82
|
+ $templateModel->edit([$filed=>$main_html],['id'=>$id]);
|
|
83
|
return true;
|
83
|
return true;
|
|
84
|
}
|
84
|
}
|
|
85
|
|
85
|
|