作者 张关杰

Merge branch 'develop' of http://47.244.231.31:8099/zhl/globalso-v6 into bate

... ... @@ -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']);
$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){
$main_html = $html;
$pattern = '/<img.*?src=[\'"]([^\'"]+)[\'"].*?>/i';
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(['main_html'=>$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);
}
}
... ...
... ... @@ -55,10 +55,12 @@ class TranslateLogic extends BaseLogic
// 原始校对程序
$old_key = [];//key值组成数据
$data_read = json_decode($info ? $info['data'] : '',JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
foreach ($data_read as $k => $v){
$k = urldecode($k);
$old_key[] = $k;
$data[] = [$k => $v];
if(!empty($data_read)){
foreach ($data_read as $k => $v){
$k = urldecode($k);
$old_key[] = $k;
$data[] = [$k => $v];
}
}
$arr2 = [];
foreach ($text_array as $val) {
... ...