作者 Your Name
... ... @@ -42,7 +42,7 @@ class ProductFileUpload extends Command
$project_id = $this->argument('project_id');
ProjectServer::useProject($project_id);
$productModel = new Product();
$lists = $productModel->list(['status'=>1,'id'=>['<=',106]]);
$lists = $productModel->list(['status'=>1,'id'=>['in',[6,7,8]]]);
foreach ($lists as $k => $v){
if(!empty($v['files']) && !empty($v['files']['url'])){
$url = str_replace_url($v['files']['url']);
... ... @@ -52,7 +52,7 @@ class ProductFileUpload extends Command
if($fileInfo === false){
continue;
}
$newName = preg_replace('#/[^/]*$#', '/', $url).$fileInfo['name'];
$newName = $fileInfo['name'];
$this->synchronizationFile($url,$newName);
$v['files']['url'] = $newName;
$productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]);
... ... @@ -71,7 +71,8 @@ class ProductFileUpload extends Command
public function synchronizationFile($path_name,$newName){
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$cmd = 'curl -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$newName.'" https://v6-file.globalso.com/upload.php';
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$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';
return shell_exec($cmd);
}
}
... ...