|
@@ -11,6 +11,7 @@ namespace App\Console\Commands\Test; |
|
@@ -11,6 +11,7 @@ namespace App\Console\Commands\Test; |
|
11
|
|
11
|
|
|
12
|
use App\Models\Project\Project;
|
12
|
use App\Models\Project\Project;
|
|
13
|
use App\Models\Template\BTemplate;
|
13
|
use App\Models\Template\BTemplate;
|
|
|
|
14
|
+use App\Models\Template\BTemplateCommon;
|
|
14
|
use App\Services\ProjectServer;
|
15
|
use App\Services\ProjectServer;
|
|
15
|
use Illuminate\Console\Command;
|
16
|
use Illuminate\Console\Command;
|
|
16
|
use Illuminate\Support\Facades\DB;
|
17
|
use Illuminate\Support\Facades\DB;
|
|
@@ -54,10 +55,9 @@ class EditVideoMp4 extends Command |
|
@@ -54,10 +55,9 @@ class EditVideoMp4 extends Command |
|
54
|
*/
|
55
|
*/
|
|
55
|
public function getHtml(){
|
56
|
public function getHtml(){
|
|
56
|
$templateModel = new BTemplate();
|
57
|
$templateModel = new BTemplate();
|
|
57
|
- $list = $templateModel->list(['id'=>1]);
|
|
|
|
58
|
- foreach ($list as $k1 => $v1){
|
|
|
|
59
|
- echo date('Y-m-d H:i:s') . '更新的id:'.$v1['id'] . PHP_EOL;
|
|
|
|
60
|
- $this->getVideoSrc($v1['id'],$v1['main_html'],'main_html');
|
58
|
+ $templateList = $templateModel->list();
|
|
|
|
59
|
+ foreach ($templateList as $v1){
|
|
|
|
60
|
+ $this->getVideoSrc($v1['id'],$v1['main_html'],'main_html',$templateModel);
|
|
61
|
}
|
61
|
}
|
|
62
|
return true;
|
62
|
return true;
|
|
63
|
}
|
63
|
}
|
|
@@ -69,17 +69,15 @@ class EditVideoMp4 extends Command |
|
@@ -69,17 +69,15 @@ 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,$filed){
|
|
|
|
73
|
- $main_html = $html;
|
72
|
+ public function getVideoSrc($id,$html,$filed,$model){
|
|
74
|
$pattern = '/<video.*?src="([^"]+)"[^>]*>/i';
|
73
|
$pattern = '/<video.*?src="([^"]+)"[^>]*>/i';
|
|
75
|
preg_match_all($pattern, $html, $matches);
|
74
|
preg_match_all($pattern, $html, $matches);
|
|
76
|
$srcLinks = $matches[1];
|
75
|
$srcLinks = $matches[1];
|
|
77
|
foreach ($srcLinks as $link) {
|
76
|
foreach ($srcLinks as $link) {
|
|
78
|
- $newLink = str_replace('v6-file.globalso.com','ecdn6.globalso.com', $link);
|
|
|
|
79
|
- $main_html = str_replace($link, $newLink, $main_html);
|
77
|
+ $newLink = str_replace('ecdn6.globalso.com','v6-file.globalso.com', $link);
|
|
|
|
78
|
+ $html = str_replace($link, $newLink, $html);
|
|
80
|
}
|
79
|
}
|
|
81
|
- $templateModel = new BTemplate();
|
|
|
|
82
|
- $templateModel->edit([$filed=>$main_html],['id'=>$id]);
|
80
|
+ $model->edit([$filed=>$html],['id'=>$id]);
|
|
83
|
return true;
|
81
|
return true;
|
|
84
|
}
|
82
|
}
|
|
85
|
|
83
|
|