Ver Fonte

Wesmiler

wesmiler há 1 mês atrás
pai
commit
b7dc524955
2 ficheiros alterados com 5 adições e 3 exclusões
  1. 3 1
      app/Helpers/common.php
  2. 2 2
      app/Services/QiniuService.php

+ 3 - 1
app/Helpers/common.php

@@ -1899,7 +1899,9 @@ if (!function_exists('upload_image')) {
         $driver = \App\Services\ConfigService::make()->getConfigByCode('file_upload_driver','local');
         if($driver == 'qiniu'){
             // 上传云
-            $file_path = \App\Services\QiniuService::make()->upload($file_name, $file);
+            if(!$file_path = \App\Services\QiniuService::make()->upload($file_name, $file)){
+                return message(\App\Services\QiniuService::make()->getError(), false);
+            }
         }else{
             // 重命名保存
             $path = $file->move($file_dir, $file_name);

+ 2 - 2
app/Services/QiniuService.php

@@ -60,7 +60,7 @@ class QiniuService extends BaseService
     {
         // 配置参数
         if(empty($this->apiKey) || empty($this->apiCode) || empty($this->bucket) || empty($this->host)){
-            $this->error = '接口参数未配置';
+            $this->error = 'QINIU接口参数未配置';
             return false;
         }
 
@@ -76,7 +76,7 @@ class QiniuService extends BaseService
         list($ret, $err) = $uploadMgr->putFile($uptoken, $filename, $file->getPathname());
 
         if ($err !== null) {
-            $this->error = '图片上传失败:' . $err->getMessage();
+            $this->error = 'QINIU图片上传失败:' . $err->getMessage();
             return false;
         } else {
             return $this->host . '/' . $filename;