作者 Your Name
@@ -103,7 +103,7 @@ class DeleteCustomCategory extends Command @@ -103,7 +103,7 @@ class DeleteCustomCategory extends Command
103 return false; 103 return false;
104 } 104 }
105 foreach ($customList['list'] as $v){ 105 foreach ($customList['list'] as $v){
106 - $category_id_arr = Arr::setToArr(trim($v['category_id'],',')); 106 + $category_id_arr = $v['category_id'];
107 if(empty($category_id_arr)){ 107 if(empty($category_id_arr)){
108 continue; 108 continue;
109 } 109 }
@@ -610,7 +610,6 @@ if (!function_exists('getFileUrl')) { @@ -610,7 +610,6 @@ if (!function_exists('getFileUrl')) {
610 return $cdn2.$path; 610 return $cdn2.$path;
611 } 611 }
612 if($location == 0){ 612 if($location == 0){
613 - //v6-file.globalso.com  
614 $cos = config('filesystems.disks.cos'); 613 $cos = config('filesystems.disks.cos');
615 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1']; 614 $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
616 return $cosCdn.$path; 615 return $cosCdn.$path;
@@ -134,7 +134,7 @@ class FileController @@ -134,7 +134,7 @@ class FileController
134 $amazonS3Service->uploadFiles($files,$this->path,$fileName); 134 $amazonS3Service->uploadFiles($files,$this->path,$fileName);
135 } 135 }
136 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name); 136 $this->saveMysql($fileModel,$files->getSize(),$files->getClientOriginalExtension(),$fileName,$hash,$this->upload_location,$files->getMimeType(),$name);
137 - $this->synchronizationFile($fileName,($this->upload_location == 0) ? 1 : 0); 137 + $this->synchronizationFile($fileName,$this->upload_location);
138 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 138 $this->response('资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
139 } 139 }
140 140
@@ -303,7 +303,7 @@ class FileController @@ -303,7 +303,7 @@ class FileController
303 $mime = $file->getMimeType(); 303 $mime = $file->getMimeType();
304 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name); 304 $this->saveMysql($fileModel,$size,$file_type,$fileName,$hash,$this->upload_location,$mime,$name);
305 $data[] = $this->responseData($this->path.'/'.$fileName, $name); 305 $data[] = $this->responseData($this->path.'/'.$fileName, $name);
306 - $this->synchronizationFile($fileName,($this->upload_location == 0) ? 1 : 0); 306 + $this->synchronizationFile($fileName,$this->upload_location);
307 } 307 }
308 $this->response('资源',Code::SUCCESS,$data); 308 $this->response('资源',Code::SUCCESS,$data);
309 } 309 }
@@ -215,7 +215,7 @@ class ImageController extends Controller @@ -215,7 +215,7 @@ class ImageController extends Controller
215 $amazonS3Service->uploadFiles($files,$this->path,$fileName); 215 $amazonS3Service->uploadFiles($files,$this->path,$fileName);
216 } 216 }
217 $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name); 217 $this->saveMysql($imageModel,$files->getSize(),$image_type,$fileName,$hash,$this->upload_location,$files->getMimeType(), $name);
218 - $this->synchronizationImage($fileName,($this->upload_location == 0) ? 1 : 0); 218 + $this->synchronizationImage($fileName,$this->upload_location);
219 return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name)); 219 return $this->response('图片资源',Code::SUCCESS,$this->responseData($this->path.'/'.$fileName, $name));
220 } 220 }
221 221
@@ -347,7 +347,7 @@ class ImageController extends Controller @@ -347,7 +347,7 @@ class ImageController extends Controller
347 } 347 }
348 //批量存储 348 //批量存储
349 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name); 349 $this->saveMysql($imageModel,$file->getSize(),$image_type,$fileName,$hash,$this->upload_location,$file->getMimeType(),$name);
350 - $this->synchronizationImage($fileName,($this->upload_location == 0) ? 1 : 0); 350 + $this->synchronizationImage($fileName,$this->upload_location);
351 $data[] = $this->responseData($this->path.'/'.$fileName,$name); 351 $data[] = $this->responseData($this->path.'/'.$fileName,$name);
352 } 352 }
353 $this->response('图片资源',Code::SUCCESS,$data); 353 $this->response('图片资源',Code::SUCCESS,$data);
@@ -359,6 +359,11 @@ class TranslateLogic extends BaseLogic @@ -359,6 +359,11 @@ class TranslateLogic extends BaseLogic
359 $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0]; 359 $data = ['source'=>4,'source_id'=>$routeInfo['source_id'],'is_list'=>1,'is_custom'=>0];
360 } 360 }
361 } 361 }
  362 + if($routeInfo['source'] == RouteMap::SOURCE_PRODUCT_KEYWORD){
  363 + if($routeInfo['source_id']){
  364 + $data = ['source'=>8,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>0];
  365 + }
  366 + }
362 if($routeInfo['source'] == RouteMap::SOURCE_MODULE){ 367 if($routeInfo['source'] == RouteMap::SOURCE_MODULE){
363 if($routeInfo['source_id']){ 368 if($routeInfo['source_id']){
364 $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1]; 369 $data = ['source'=>7,'source_id'=>$routeInfo['source_id'],'is_list'=>0,'is_custom'=>1];
@@ -38,8 +38,9 @@ class SyncImageFileJob implements ShouldQueue @@ -38,8 +38,9 @@ class SyncImageFileJob implements ShouldQueue
38 */ 38 */
39 public function handle() 39 public function handle()
40 { 40 {
41 - $file_path = getImageUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']); 41 + $file_path = $this->getUrl($this->param['path'].'/'.$this->param['name'], 0,$this->param['location']);
42 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php'; 42 $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$this->param['path'].'" https://v6-file.globalso.com/upload.php';
  43 + echo date('Y-m-d H:i:s') . ' | ' . $cmd . PHP_EOL;
43 $code = shell_exec($cmd); 44 $code = shell_exec($cmd);
44 if(200 != (int)$code){ 45 if(200 != (int)$code){
45 $errorFileModel = new ErrorFile(); 46 $errorFileModel = new ErrorFile();
@@ -47,4 +48,40 @@ class SyncImageFileJob implements ShouldQueue @@ -47,4 +48,40 @@ class SyncImageFileJob implements ShouldQueue
47 } 48 }
48 return true; 49 return true;
49 } 50 }
  51 +
  52 + /**
  53 + * @remark :获取图片文件链接
  54 + * @name :getUrl
  55 + * @author :lyh
  56 + * @method :post
  57 + * @time :2024/5/22 11:53
  58 + */
  59 + public function getUrl($path,$storage_type,$location){
  60 + if(is_array($path)){
  61 + $url =[];
  62 + foreach ($path as $v){
  63 + $url[] = $this->getUrl($v,$storage_type,$location);
  64 + }
  65 + }else{
  66 + if(empty($path)){
  67 + return '';
  68 + }
  69 + if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){
  70 + return $path;
  71 + }
  72 + if(substr($path,0,2) == '//'){
  73 + return 'https:'.$path;
  74 + }
  75 + if($location == 0){
  76 + $cos = config('filesystems.disks.cos');
  77 + $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
  78 + $url = $cosCdn.$path;
  79 + }else{
  80 + $s3 = config('filesystems.disks.s3');
  81 + $cdn = $s3['cdn'];
  82 + $url = $cdn.$path;
  83 + }
  84 + }
  85 + return $url;
  86 + }
50 } 87 }