作者 lyh

gx

@@ -52,7 +52,7 @@ class ProductFileUpload extends Command @@ -52,7 +52,7 @@ class ProductFileUpload extends Command
52 if($fileInfo === false){ 52 if($fileInfo === false){
53 continue; 53 continue;
54 } 54 }
55 - $newName = preg_replace('#/[^/]*$#', '/', $url).$fileInfo['name']; 55 + $newName = $fileInfo['name'];
56 $this->synchronizationFile($url,$newName); 56 $this->synchronizationFile($url,$newName);
57 $v['files']['url'] = $newName; 57 $v['files']['url'] = $newName;
58 $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]); 58 $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]);
@@ -71,7 +71,8 @@ class ProductFileUpload extends Command @@ -71,7 +71,8 @@ class ProductFileUpload extends Command
71 public function synchronizationFile($path_name,$newName){ 71 public function synchronizationFile($path_name,$newName){
72 //同步到大文件 72 //同步到大文件
73 $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; 73 $file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
74 - $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$newName.'" https://v6-file.globalso.com/upload.php'; 74 + $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
  75 + $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" -F "file_name='.$newName.'" https://v6-file.globalso.com/fileUpload.php';
75 return shell_exec($cmd); 76 return shell_exec($cmd);
76 } 77 }
77 } 78 }