作者 Your Name
@@ -42,7 +42,7 @@ class ProductFileUpload extends Command @@ -42,7 +42,7 @@ class ProductFileUpload extends Command
42 $project_id = $this->argument('project_id'); 42 $project_id = $this->argument('project_id');
43 ProjectServer::useProject($project_id); 43 ProjectServer::useProject($project_id);
44 $productModel = new Product(); 44 $productModel = new Product();
45 - $lists = $productModel->list(['status'=>1,'id'=>['<=',106]]); 45 + $lists = $productModel->list(['status'=>1,'id'=>['in',[6,7,8]]]);
46 foreach ($lists as $k => $v){ 46 foreach ($lists as $k => $v){
47 if(!empty($v['files']) && !empty($v['files']['url'])){ 47 if(!empty($v['files']) && !empty($v['files']['url'])){
48 $url = str_replace_url($v['files']['url']); 48 $url = str_replace_url($v['files']['url']);
@@ -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 }