dev
Jing Li 2023-08-30 14:09:15 +08:00
parent a037f82a5f
commit 01a057bfc8
2 changed files with 7 additions and 2 deletions

View File

@ -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,

View File

@ -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(),
];
}
}