Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
AuroraYolo committed Dec 26, 2020
1 parent 14ede6f commit d88565d
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions app/Controller/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,4 @@ public function userChatFile(): ResponseInterface
return $this->response->error('文件不存在...');
}

public function download(string $saveDir, string $originalName): ResponseInterface
{
$factory = di(FilesystemFactory::class)->get('qiniu');
if ($factory->has($saveDir)) {
$dir = config('file.storage.local.root');
$contents = $factory->read($saveDir);
$fileSystem = di(FilesystemFactory::class)->get('local');
if ($fileSystem->has($saveDir)) {
return $this->response->download($dir . '/' . $saveDir, $originalName);
}
$fileSystem->write($saveDir, $contents);
return $this->response->download($dir . '/' . $saveDir, $originalName);
}
return $this->response->error('文件不存在...');
}
}

0 comments on commit d88565d

Please sign in to comment.