作者 lyh

gx

@@ -48,14 +48,17 @@ class ProductFileUpload extends Command @@ -48,14 +48,17 @@ class ProductFileUpload extends Command
48 $url = str_replace_url($v['files']['url']); 48 $url = str_replace_url($v['files']['url']);
49 //获取当前图片的原名称 49 //获取当前图片的原名称
50 $files = new File(); 50 $files = new File();
51 - $fileInfo = $files->read(['path'=>$url]); 51 + $fileInfo = $files->read(['path'=>$url,'project_id'=>$project_id]);
52 if($fileInfo === false){ 52 if($fileInfo === false){
53 continue; 53 continue;
54 } 54 }
55 $newName = $fileInfo['name']; 55 $newName = $fileInfo['name'];
56 - $this->synchronizationFile($url,$newName);  
57 - $v['files']['url'] = $newName;  
58 - $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]); 56 + $code = $this->synchronizationFile($url,$newName);
  57 + if((int)$code == 200){
  58 + echo date('Y-m-d H:i:s') . '编辑的path为:'. $url .',主键id:'. $v['id'] . PHP_EOL;
  59 + $v['files']['url'] = $newName;
  60 + $productModel->edit(['files'=>json_encode($v['files'])],['id'=>$v['id']]);
  61 + }
59 } 62 }
60 } 63 }
61 DB::disconnect('custom_mysql'); 64 DB::disconnect('custom_mysql');