作者 李宇航

合并分支 'develop' 到 'master'

Develop



查看合并请求 !485
@@ -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
@@ -53,7 +53,7 @@ if (!function_exists('http_post')) { @@ -53,7 +53,7 @@ if (!function_exists('http_post')) {
53 * @param type $url 53 * @param type $url
54 * @param type $post_data 54 * @param type $post_data
55 */ 55 */
56 - function http_post($url, $post_data, $header = []) 56 + function http_post($url, $post_data, $header = [],$is_json = true)
57 { 57 {
58 if (empty($header)) { 58 if (empty($header)) {
59 $header = array( 59 $header = array(
@@ -78,8 +78,11 @@ if (!function_exists('http_post')) { @@ -78,8 +78,11 @@ if (!function_exists('http_post')) {
78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND); 78 @file_put_contents(storage_path('logs/lyh_error.log'), var_export($error_message, true) . PHP_EOL, FILE_APPEND);
79 } 79 }
80 curl_close($ch); 80 curl_close($ch);
  81 + if($is_json){
81 return json_decode($res, true); 82 return json_decode($res, true);
82 } 83 }
  84 + return trim($res);
  85 + }
83 } 86 }
84 87
85 88
@@ -24,6 +24,7 @@ use App\Models\User\DeptUser; @@ -24,6 +24,7 @@ use App\Models\User\DeptUser;
24 use App\Models\User\ProjectRole; 24 use App\Models\User\ProjectRole;
25 use App\Models\User\User; 25 use App\Models\User\User;
26 use App\Utils\EncryptUtils; 26 use App\Utils\EncryptUtils;
  27 +use http\Client\Response;
27 use Illuminate\Support\Facades\Cache; 28 use Illuminate\Support\Facades\Cache;
28 use Mrgoon\AliSms\AliSms; 29 use Mrgoon\AliSms\AliSms;
29 30
@@ -310,4 +311,13 @@ class LoginController extends BaseController @@ -310,4 +311,13 @@ class LoginController extends BaseController
310 } 311 }
311 return $data; 312 return $data;
312 } 313 }
  314 +
  315 + public function ceshi(){
  316 + //同步到大文件
  317 + $path = '/upload/m/video/2023-08';
  318 + $fileName = '64e81b9b80b1331590.mp4';
  319 + $file_path = config('filesystems.disks.cos')['cdn1'].$path.'/'.$fileName;
  320 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$path.'" https://v6-file.globalso.com/upload.php';
  321 + echo shell_exec($cmd);
  322 + }
313 } 323 }
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 namespace App\Http\Controllers\File; 3 namespace App\Http\Controllers\File;
4 4
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
  6 +use App\Models\File\ErrorFile;
6 use App\Models\File\File; 7 use App\Models\File\File;
7 use App\Models\Project\Project; 8 use App\Models\Project\Project;
8 use App\Services\AmazonS3Service; 9 use App\Services\AmazonS3Service;
@@ -145,7 +146,12 @@ class FileController @@ -145,7 +146,12 @@ class FileController
145 //同步到大文件 146 //同步到大文件
146 $file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName; 147 $file_path = config('filesystems.disks.cos')['cdn1'].$this->path.'/'.$fileName;
147 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; 148 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
148 - shell_exec($cmd); 149 + $code = shell_exec($cmd);
  150 + if(200 != (int)$code){
  151 + $errorFileModel = new ErrorFile();
  152 + $errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
  153 + }
  154 + return true;
149 } 155 }
150 156
151 /** 157 /**
@@ -5,6 +5,7 @@ namespace App\Http\Controllers\File; @@ -5,6 +5,7 @@ namespace App\Http\Controllers\File;
5 use App\Enums\Common\Code; 5 use App\Enums\Common\Code;
6 use App\Http\Controllers\Controller; 6 use App\Http\Controllers\Controller;
7 use App\Http\Controllers\type; 7 use App\Http\Controllers\type;
  8 +use App\Models\File\ErrorFile;
8 use App\Models\File\Image as ImageModel; 9 use App\Models\File\Image as ImageModel;
9 use App\Models\Project\Project; 10 use App\Models\Project\Project;
10 use App\Services\AmazonS3Service; 11 use App\Services\AmazonS3Service;
@@ -225,7 +226,12 @@ class ImageController extends Controller @@ -225,7 +226,12 @@ class ImageController extends Controller
225 //同步到大文件 226 //同步到大文件
226 $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0); 227 $file_path = getImageUrl($this->path.'/'.$fileName,$this->cache['storage_type'] ?? 0);
227 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php'; 228 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->path.'" https://v6-file.globalso.com/upload.php';
228 - shell_exec($cmd); 229 + $code = shell_exec($cmd);
  230 + if(200 != (int)$code){
  231 + $errorFileModel = new ErrorFile();
  232 + $errorFileModel->add(['path'=>$this->path.'/'.$fileName]);
  233 + }
  234 + return true;
229 } 235 }
230 236
231 /** 237 /**
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :ErrorFile.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/4/16 17:00
  8 + */
  9 +
  10 +namespace App\Models\File;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class ErrorFile extends Base
  15 +{
  16 + protected $table = 'gl_error_file';
  17 +}