Merge branch 'feature/add_cdn' into dev

master
ELF 5 years ago
commit 6b7d1b9b51

@ -75,9 +75,14 @@ class PictureModel extends Model{
$saveFileName = 'icon/' . $path[4]; $saveFileName = 'icon/' . $path[4];
$localFilePath = '.' . $value['path']; $localFilePath = '.' . $value['path'];
$ossService = new OssService(); $ossService = new OssService();
$ossService->upload($localFilePath, $saveFileName); $result = $ossService->upload($localFilePath, $saveFileName);
if ($result['status']) {
$dataUrl['oss_url'] = $ossService->getUrl($saveFileName); $dataUrl['oss_url'] = $ossService->getUrl($saveFileName);
$coo = $this->where(['id' => $value['id']])->save($dataUrl); $coo = $this->where(['id' => $value['id']])->save($dataUrl);
} else {
$this->error = $result['message'];
return false;
}
} }
} }
return $info; //文件上传成功 return $info; //文件上传成功

@ -62,8 +62,13 @@ class PictureModel extends Model{
$localFilePath = '.' . $value['path']; $localFilePath = '.' . $value['path'];
$ossService = new OssService(); $ossService = new OssService();
$ossService->upload($localFilePath, $saveFileName); $ossService->upload($localFilePath, $saveFileName);
if ($result['status']) {
$dataUrl['oss_url'] = $ossService->getUrl($saveFileName); $dataUrl['oss_url'] = $ossService->getUrl($saveFileName);
$coo = $this->where(['id' => $value['id']])->save($dataUrl); $coo = $this->where(['id' => $value['id']])->save($dataUrl);
} else {
$this->error = $result['message'];
return false;
}
} }
} }
return $info; //文件上传成功 return $info; //文件上传成功

Loading…
Cancel
Save