作者 李宇航

合并分支 'develop' 到 'master'

Develop



查看合并请求 !485
... ... @@ -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;
}
... ...
... ... @@ -53,7 +53,7 @@ if (!function_exists('http_post')) {
* @param type $url
* @param type $post_data
*/
function http_post($url, $post_data, $header = [])
function http_post($url, $post_data, $header = [],$is_json = true)
{
if (empty($header)) {
$header = array(
... ... @@ -78,7 +78,10 @@ if (!function_exists('http_post')) {
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
}
curl_close($ch);
return json_decode($res, true);
if($is_json){
return json_decode($res, true);
}
return trim($res);
}
}
... ...
... ... @@ -24,6 +24,7 @@ use App\Models\User\DeptUser;
use App\Models\User\ProjectRole;
use App\Models\User\User;
use App\Utils\EncryptUtils;
use http\Client\Response;
use Illuminate\Support\Facades\Cache;
use Mrgoon\AliSms\AliSms;
... ... @@ -310,4 +311,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';
echo shell_exec($cmd);
}
}
... ...
... ... @@ -3,6 +3,7 @@
namespace App\Http\Controllers\File;
use App\Enums\Common\Code;
use App\Models\File\ErrorFile;
use App\Models\File\File;
use App\Models\Project\Project;
use App\Services\AmazonS3Service;
... ... @@ -145,7 +146,12 @@ class FileController
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName;
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
shell_exec($cmd);
$code = shell_exec($cmd);
if(200 != (int)$code){
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
}
return true;
}
/**
... ...
... ... @@ -5,6 +5,7 @@ namespace App\Http\Controllers\File;
use App\Enums\Common\Code;
use App\Http\Controllers\Controller;
use App\Http\Controllers\type;
use App\Models\File\ErrorFile;
use App\Models\File\Image as ImageModel;
use App\Models\Project\Project;
use App\Services\AmazonS3Service;
... ... @@ -225,7 +226,12 @@ class ImageController extends Controller
//同步到大文件
$file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
shell_exec($cmd);
$code = shell_exec($cmd);
if(200 != (int)$code){
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
}
return true;
}
/**
... ...
<?php
/**
* @remark :
* @name :ErrorFile.php
* @author :lyh
* @method :post
* @time :2024/4/16 17:00
*/
namespace App\Models\File;
use App\Models\Base;
class ErrorFile extends Base
{
protected $table = 'gl_error_file';
}
... ...