正在显示
1 个修改的文件
包含
11 行增加
和
6 行删除
| @@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
| 2 | 2 | ||
| 3 | namespace App\Services; | 3 | namespace App\Services; |
| 4 | 4 | ||
| 5 | +use App\Utils\LogUtils; | ||
| 5 | use Qcloud\Cos\Client; | 6 | use Qcloud\Cos\Client; |
| 6 | /** | 7 | /** |
| 7 | * @remark :对象存储cos | 8 | * @remark :对象存储cos |
| @@ -88,12 +89,16 @@ class CosService | @@ -88,12 +89,16 @@ class CosService | ||
| 88 | ], | 89 | ], |
| 89 | ]); | 90 | ]); |
| 90 | $key = $path.'/'.$filename; | 91 | $key = $path.'/'.$filename; |
| 91 | - $cosClient->putObject([ | ||
| 92 | - 'Bucket' => $cos['bucket'], | ||
| 93 | - 'Key' => $key, | ||
| 94 | - 'Body' => fopen($file_url, 'r'), | ||
| 95 | - ]); | ||
| 96 | - return $key; | 92 | + try { |
| 93 | + $cosClient->putObject([ | ||
| 94 | + 'Bucket' => $cos['bucket'], | ||
| 95 | + 'Key' => $key, | ||
| 96 | + 'Body' => fopen($file_url, 'r'), | ||
| 97 | + ]); | ||
| 98 | + return $key; | ||
| 99 | + }catch (\Exception $e){ | ||
| 100 | + LogUtils::error('uploadRemote error', $e->getMessage()); | ||
| 101 | + } | ||
| 97 | } | 102 | } |
| 98 | 103 | ||
| 99 | } | 104 | } |
-
请 注册 或 登录 后发表评论