|
@@ -38,7 +38,7 @@ class SyncImageFileJob implements ShouldQueue |
|
@@ -38,7 +38,7 @@ 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
|
$code = shell_exec($cmd);
|
43
|
$code = shell_exec($cmd);
|
|
44
|
if(200 != (int)$code){
|
44
|
if(200 != (int)$code){
|
|
@@ -47,4 +47,40 @@ class SyncImageFileJob implements ShouldQueue |
|
@@ -47,4 +47,40 @@ class SyncImageFileJob implements ShouldQueue |
|
47
|
}
|
47
|
}
|
|
48
|
return true;
|
48
|
return true;
|
|
49
|
}
|
49
|
}
|
|
|
|
50
|
+
|
|
|
|
51
|
+ /**
|
|
|
|
52
|
+ * @remark :获取图片文件链接
|
|
|
|
53
|
+ * @name :getUrl
|
|
|
|
54
|
+ * @author :lyh
|
|
|
|
55
|
+ * @method :post
|
|
|
|
56
|
+ * @time :2024/5/22 11:53
|
|
|
|
57
|
+ */
|
|
|
|
58
|
+ public function getUrl($path,$storage_type,$location){
|
|
|
|
59
|
+ if(is_array($path)){
|
|
|
|
60
|
+ $url =[];
|
|
|
|
61
|
+ foreach ($path as $v){
|
|
|
|
62
|
+ $url[] = $this->getUrl($v,$storage_type,$location);
|
|
|
|
63
|
+ }
|
|
|
|
64
|
+ }else{
|
|
|
|
65
|
+ if(empty($path)){
|
|
|
|
66
|
+ return '';
|
|
|
|
67
|
+ }
|
|
|
|
68
|
+ if((strpos($path,'https://')!== false) || (strpos($path,'http://') !== false)){
|
|
|
|
69
|
+ return $path;
|
|
|
|
70
|
+ }
|
|
|
|
71
|
+ if(substr($path,0,2) == '//'){
|
|
|
|
72
|
+ return 'https:'.$path;
|
|
|
|
73
|
+ }
|
|
|
|
74
|
+ if($location == 0){
|
|
|
|
75
|
+ $cos = config('filesystems.disks.cos');
|
|
|
|
76
|
+ $cosCdn = ($storage_type == 0) ? $cos['cdn'] : $cos['cdn1'];
|
|
|
|
77
|
+ $url = $cosCdn.$path;
|
|
|
|
78
|
+ }else{
|
|
|
|
79
|
+ $s3 = config('filesystems.disks.s3');
|
|
|
|
80
|
+ $cdn = $s3['cdn'];
|
|
|
|
81
|
+ $url = $cdn.$path;
|
|
|
|
82
|
+ }
|
|
|
|
83
|
+ }
|
|
|
|
84
|
+ return $url;
|
|
|
|
85
|
+ }
|
|
50
|
} |
86
|
} |