|
@@ -106,10 +106,12 @@ class FileUploadService extends Service
|
|
|
$date = \DateTime::createFromFormat('Ymd', $timestamp);
|
|
|
$date = $date->format('Y-m-d');
|
|
|
$dir = FileUploadService::tmp_dir . '/' . $date . '/' . $filename;
|
|
|
- $realPath = storage_path() . "/app/public/" . $dir;
|
|
|
- $savePath = self::string3 . $date . '/' . $filename;
|
|
|
- list($status,$msg) = (new OssService())->uploadFile($realPath,$savePath);
|
|
|
- if($status) Storage::disk('public')->delete($dir);
|
|
|
+ if(Storage::disk('public')->exists($dir)){
|
|
|
+ $realPath = storage_path() . "/app/public/" . $dir;
|
|
|
+ $savePath = self::string3 . $date . '/' . $filename;
|
|
|
+ list($status,$msg) = (new OssService())->uploadFile($realPath,$savePath);
|
|
|
+ if($status) Storage::disk('public')->delete($dir);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -144,8 +146,9 @@ class FileUploadService extends Service
|
|
|
$date = \DateTime::createFromFormat('Ymd', $timestamp);
|
|
|
$date = $date->format('Y-m-d');
|
|
|
$dir = FileUploadService::tmp_dir . '/' . $date . '/' . $filename;
|
|
|
- $realPath = storage_path() . "/app/public/" . $dir;
|
|
|
+ if(! Storage::disk('public')->exists($dir)) return;
|
|
|
|
|
|
+ $realPath = storage_path() . "/app/public/" . $dir;
|
|
|
foreach ($file['img_list'] as $filename){
|
|
|
$filename_tmp = str_replace(FileUploadService::string.FileUploadService::string2,'', $filename);
|
|
|
$savePath = self::string3 . $date . '/' . $filename_tmp;
|