diff --git a/Application/Admin/Model/PictureModel.class.php b/Application/Admin/Model/PictureModel.class.php index 32ffa23cd..69e0dd3d0 100644 --- a/Application/Admin/Model/PictureModel.class.php +++ b/Application/Admin/Model/PictureModel.class.php @@ -75,9 +75,14 @@ class PictureModel extends Model{ $saveFileName = 'icon/' . $path[4]; $localFilePath = '.' . $value['path']; $ossService = new OssService(); - $ossService->upload($localFilePath, $saveFileName); - $dataUrl['oss_url'] = $ossService->getUrl($saveFileName); - $coo = $this->where(['id' => $value['id']])->save($dataUrl); + $result = $ossService->upload($localFilePath, $saveFileName); + if ($result['status']) { + $dataUrl['oss_url'] = $ossService->getUrl($saveFileName); + $coo = $this->where(['id' => $value['id']])->save($dataUrl); + } else { + $this->error = $result['message']; + return false; + } } } return $info; //文件上传成功 diff --git a/Application/Home/Model/PictureModel.class.php b/Application/Home/Model/PictureModel.class.php index 4b979ae2a..bdfdc8010 100644 --- a/Application/Home/Model/PictureModel.class.php +++ b/Application/Home/Model/PictureModel.class.php @@ -62,8 +62,13 @@ class PictureModel extends Model{ $localFilePath = '.' . $value['path']; $ossService = new OssService(); $ossService->upload($localFilePath, $saveFileName); - $dataUrl['oss_url'] = $ossService->getUrl($saveFileName); - $coo = $this->where(['id' => $value['id']])->save($dataUrl); + if ($result['status']) { + $dataUrl['oss_url'] = $ossService->getUrl($saveFileName); + $coo = $this->where(['id' => $value['id']])->save($dataUrl); + } else { + $this->error = $result['message']; + return false; + } } } return $info; //文件上传成功