疯狂的狮子li
2021-11-01 c4e17ff8472fd9f8123e86b593b2968ad5936b15
ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java
@@ -22,11 +22,12 @@
 */
public class QiniuCloudStorageStrategy extends AbstractCloudStorageStrategy {
   private final UploadManager uploadManager;
   private final BucketManager bucketManager;
   private final String token;
   private UploadManager uploadManager;
   private BucketManager bucketManager;
   private String token;
   public QiniuCloudStorageStrategy(CloudStorageProperties cloudStorageProperties) {
   @Override
   public void init(CloudStorageProperties cloudStorageProperties) {
      properties = cloudStorageProperties;
      try {
         Configuration config = new Configuration(getRegion(properties.getRegion()));
@@ -43,7 +44,7 @@
            bucketManager.createBucket(bucketName, properties.getRegion());
         }
      } catch (Exception e) {
         throw new IllegalArgumentException("七牛云存储配置错误! 请检查系统配置!");
         throw new OssException("七牛云存储配置错误! 请检查系统配置:[" + e.getMessage() + "]");
      }
   }
@@ -56,7 +57,7 @@
         }
         bucketManager.createBucket(bucketName, properties.getRegion());
      } catch (Exception e) {
         throw new OssException("创建Bucket失败, 请核对七牛云配置信息");
         throw new OssException("创建Bucket失败, 请核对七牛云配置信息:[" + e.getMessage() + "]");
      }
   }
@@ -73,7 +74,7 @@
            throw new RuntimeException("上传七牛出错:" + res.toString());
         }
      } catch (Exception e) {
         throw new OssException("上传文件失败,请核对七牛配置信息");
         throw new OssException("上传文件失败,请核对七牛配置信息:[" + e.getMessage() + "]");
      }
      return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path);
   }