作者 lyh

gx

... ... @@ -52,8 +52,10 @@ class ProductFileUpload extends Command
if($fileInfo === false){
continue;
}
$newName = $result = preg_replace('#/[^/]*$#', '/', $url).$fileInfo['name'];
@file_put_contents(storage_path('logs/lyh_error.log'), var_export($newName, true) . PHP_EOL, FILE_APPEND);
$newName = preg_replace('#/[^/]*$#', '/', $url).$fileInfo['name'];
$this->synchronizationFile($url,$newName);
$v['files']['url'] = $newName;
$productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]);
}
}
DB::disconnect('custom_mysql');
... ... @@ -69,7 +71,6 @@ class ProductFileUpload extends Command
public function synchronizationFile($path_name,$newName){
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$newName.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...