Commit e75e021a authored by chentianyu's avatar chentianyu

修复oss生产唯一文件名

parent c2faac04
...@@ -83,7 +83,7 @@ class UploadOssService ...@@ -83,7 +83,7 @@ class UploadOssService
$clientFilename = $image->getClientFilename(); $clientFilename = $image->getClientFilename();
$fileName = $uniqueFileName ? ($this->genUniqueFileName() . '.' . $ext) : $clientFilename; $fileName = $uniqueFileName ? ($this->genUniqueFileName() . '.' . $ext) : $clientFilename;
$options = ['mime' => ['jpeg', 'png', 'gif', 'jpg', 'svg']]; $options = ['mime' => ['jpeg', 'png', 'gif', 'jpg', 'svg']];
$filePath = 'oss2/' . $this->appDev . "/" . $this->appName . "/$module/images/" . today() . "/$userId/" . $clientFilename; $filePath = 'oss2/' . $this->appDev . "/" . $this->appName . "/$module/images/" . today() . "/$userId/" . $fileName;
$this->upload($image, $filePath, $options); $this->upload($image, $filePath, $options);
if($this->autoSaveDataBase){ if($this->autoSaveDataBase){
$model = new FileModel(); $model = new FileModel();
...@@ -118,7 +118,7 @@ class UploadOssService ...@@ -118,7 +118,7 @@ class UploadOssService
$ext = $file->getExtension(); $ext = $file->getExtension();
$clientFilename = $file->getClientFilename(); $clientFilename = $file->getClientFilename();
$fileName = $uniqueFileName ? ($this->genUniqueFileName() . '.' . $ext) : $clientFilename; $fileName = $uniqueFileName ? ($this->genUniqueFileName() . '.' . $ext) : $clientFilename;
$filePath = 'oss2/' . $this->appDev . "/" . $this->appName . "/$module/files/" . today() . "/$userId/" . $clientFilename; $filePath = 'oss2/' . $this->appDev . "/" . $this->appName . "/$module/files/" . today() . "/$userId/" . $fileName;
$this->upload($file, $filePath, $options); $this->upload($file, $filePath, $options);
if($this->autoSaveDataBase){ if($this->autoSaveDataBase){
$model = new FileModel(); $model = new FileModel();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment