正在显示
1 个修改的文件
包含
4 行增加
和
3 行删除
| @@ -52,8 +52,10 @@ class ProductFileUpload extends Command | @@ -52,8 +52,10 @@ class ProductFileUpload extends Command | ||
| 52 | if($fileInfo === false){ | 52 | if($fileInfo === false){ |
| 53 | continue; | 53 | continue; |
| 54 | } | 54 | } |
| 55 | - $newName = $result = preg_replace('#/[^/]*$#', '/', $url).$fileInfo['name']; | ||
| 56 | - @file_put_contents(storage_path('logs/lyh_error.log'), var_export($newName, true) . PHP_EOL, FILE_APPEND); | 55 | + $newName = preg_replace('#/[^/]*$#', '/', $url).$fileInfo['name']; |
| 56 | + $this->synchronizationFile($url,$newName); | ||
| 57 | + $v['files']['url'] = $newName; | ||
| 58 | + $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]); | ||
| 57 | } | 59 | } |
| 58 | } | 60 | } |
| 59 | DB::disconnect('custom_mysql'); | 61 | DB::disconnect('custom_mysql'); |
| @@ -69,7 +71,6 @@ class ProductFileUpload extends Command | @@ -69,7 +71,6 @@ class ProductFileUpload extends Command | ||
| 69 | public function synchronizationFile($path_name,$newName){ | 71 | public function synchronizationFile($path_name,$newName){ |
| 70 | //同步到大文件 | 72 | //同步到大文件 |
| 71 | $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; | 73 | $file_path = config('filesystems.disks.cos')['cdn1'].$path_name; |
| 72 | - $directoryPath = pathinfo($path_name, PATHINFO_DIRNAME); | ||
| 73 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$newName.'" https://v6-file.globalso.com/upload.php'; | 74 | $cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$newName.'" https://v6-file.globalso.com/upload.php'; |
| 74 | return shell_exec($cmd); | 75 | return shell_exec($cmd); |
| 75 | } | 76 | } |
-
请 注册 或 登录 后发表评论