作者 lyh

gx

... ... @@ -11,6 +11,7 @@ namespace App\Console\Commands\Test;
use App\Models\Project\Project;
use App\Models\Template\BTemplate;
use App\Models\Template\BTemplateCommon;
use App\Services\ProjectServer;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
... ... @@ -54,10 +55,9 @@ class EditVideoMp4 extends Command
*/
public function getHtml(){
$templateModel = new BTemplate();
$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'],'main_html');
$templateList = $templateModel->list();
foreach ($templateList as $v1){
$this->getVideoSrc($v1['id'],$v1['main_html'],'main_html',$templateModel);
}
return true;
}
... ... @@ -69,17 +69,15 @@ class EditVideoMp4 extends Command
* @method :post
* @time :2024/4/16 9:46
*/
public function getVideoSrc($id,$html,$filed){
$main_html = $html;
public function getVideoSrc($id,$html,$filed,$model){
$pattern = '/<video.*?src="([^"]+)"[^>]*>/i';
preg_match_all($pattern, $html, $matches);
$srcLinks = $matches[1];
foreach ($srcLinks as $link) {
$newLink = str_replace('v6-file.globalso.com','ecdn6.globalso.com', $link);
$main_html = str_replace($link, $newLink, $main_html);
$newLink = str_replace('ecdn6.globalso.com','v6-file.globalso.com', $link);
$html = str_replace($link, $newLink, $html);
}
$templateModel = new BTemplate();
$templateModel->edit([$filed=>$main_html],['id'=>$id]);
$model->edit([$filed=>$html],['id'=>$id]);
return true;
}
... ...
... ... @@ -310,4 +310,13 @@ class LoginController extends BaseController
}
return $data;
}
public function ceshi(){
//同步到大文件
$path = '/upload/m/video/2023-08';
$fileName = '64e81b9b80b1331590.mp4';
$file_path = config('filesystems.disks.cos')['cdn1'].$path.'/'.$fileName;
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$path.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
}
... ...