正在显示
1 个修改的文件
包含
11 行增加
和
7 行删除
| @@ -54,9 +54,10 @@ class EditVideoMp4 extends Command | @@ -54,9 +54,10 @@ class EditVideoMp4 extends Command | ||
| 54 | */ | 54 | */ |
| 55 | public function getHtml(){ | 55 | public function getHtml(){ |
| 56 | $templateModel = new BTemplate(); | 56 | $templateModel = new BTemplate(); |
| 57 | - $list = $templateModel->list(); | 57 | + $list = $templateModel->list(['id'=>1]); |
| 58 | foreach ($list as $k1 => $v1){ | 58 | foreach ($list as $k1 => $v1){ |
| 59 | - $this->getVideoSrc($v1['main_html']); | 59 | + echo date('Y-m-d H:i:s') . '更新的id:'.$v1['id'] . PHP_EOL; |
| 60 | + $this->getVideoSrc($v1['id'],$v1['main_html']); | ||
| 60 | } | 61 | } |
| 61 | return true; | 62 | return true; |
| 62 | } | 63 | } |
| @@ -68,18 +69,21 @@ class EditVideoMp4 extends Command | @@ -68,18 +69,21 @@ class EditVideoMp4 extends Command | ||
| 68 | * @method :post | 69 | * @method :post |
| 69 | * @time :2024/4/16 9:46 | 70 | * @time :2024/4/16 9:46 |
| 70 | */ | 71 | */ |
| 71 | - public function getVideoSrc($html){ | ||
| 72 | - $videoArr = []; | 72 | + public function getVideoSrc($id,$html){ |
| 73 | + $main_html = $html; | ||
| 73 | $pattern = '/<img.*?src=[\'"]([^\'"]+)[\'"].*?>/i'; | 74 | $pattern = '/<img.*?src=[\'"]([^\'"]+)[\'"].*?>/i'; |
| 74 | preg_match_all($pattern, $html, $matches); | 75 | preg_match_all($pattern, $html, $matches); |
| 75 | $srcLinks = $matches[1]; | 76 | $srcLinks = $matches[1]; |
| 76 | foreach ($srcLinks as $link) { | 77 | foreach ($srcLinks as $link) { |
| 77 | - $videoArr[] = $link; | 78 | + $newLink = str_replace('ecdn6.globalso.com', 'v6-file.globalso.com', $link); |
| 79 | + $main_html = str_replace($link, $newLink, $main_html); | ||
| 78 | } | 80 | } |
| 79 | - dd($videoArr); | ||
| 80 | - return $videoArr; | 81 | + $templateModel = new BTemplate(); |
| 82 | + $templateModel->edit(['main_html'=>$main_html],['id'=>$id]); | ||
| 83 | + return true; | ||
| 81 | } | 84 | } |
| 82 | 85 | ||
| 86 | + | ||
| 83 | /** | 87 | /** |
| 84 | * @remark :复制表 | 88 | * @remark :复制表 |
| 85 | * @name :copyTable | 89 | * @name :copyTable |
-
请 注册 或 登录 后发表评论