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