diff --git a/app/Console/Commands/BiAng/DeviceLogSyncCommand.php b/app/Console/Commands/BiAng/DeviceLogSyncCommand.php index b90a0ab..8a03bc7 100644 --- a/app/Console/Commands/BiAng/DeviceLogSyncCommand.php +++ b/app/Console/Commands/BiAng/DeviceLogSyncCommand.php @@ -148,8 +148,13 @@ class DeviceLogSyncCommand extends Command if ($ext = pathinfo($item['url'], PATHINFO_EXTENSION)) { $name .= ".{$ext}"; } + $path = "{$dir}/{$name}"; - $disk->put($path, file_get_contents($item['url'])); + + $disk = Storage::disk('public'); + if (! $disk->exists($path)) { + $disk->put($path, file_get_contents($item['url'])); + } WormPhoto::firstOrCreate([ 'device_id' => $device->id, diff --git a/app/Http/Resources/WormPhotoResource.php b/app/Http/Resources/WormPhotoResource.php index 773bd26..d46ea9c 100644 --- a/app/Http/Resources/WormPhotoResource.php +++ b/app/Http/Resources/WormPhotoResource.php @@ -11,7 +11,7 @@ class WormPhotoResource extends JsonResource return [ 'id' => $this->id, 'url' => $this->image_url, - 'time' => $this->created_at->toDateTimeString(), + 'time' => $this->uploaded_at->toDateTimeString(), ]; } }