From d2ec3e7d9ab484563e208d761888a17a7d3675bc Mon Sep 17 00:00:00 2001 From: 疯狂的狮子Li <15040126243@163.com> Date: 星期三, 10 十一月 2021 22:10:25 +0800 Subject: [PATCH] update 移除 sql 脚本 quartz 相关表数据 --- ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java index c70e6ed..0c23e76 100644 --- a/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java +++ b/ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java @@ -24,7 +24,7 @@ private UploadManager uploadManager; private BucketManager bucketManager; - private String token; + private Auth auth; @Override public void init(CloudStorageProperties cloudStorageProperties) { @@ -35,16 +35,15 @@ config.useHttpsDomains = false; config.useHttpsDomains = "Y".equals(properties.getIsHttps()); uploadManager = new UploadManager(config); - Auth auth = Auth.create(properties.getAccessKey(), properties.getSecretKey()); + auth = Auth.create(properties.getAccessKey(), properties.getSecretKey()); String bucketName = properties.getBucketName(); - token = auth.uploadToken(bucketName); bucketManager = new BucketManager(auth, config); if (!ArrayUtil.contains(bucketManager.buckets(), bucketName)) { bucketManager.createBucket(bucketName, properties.getRegion()); } } catch (Exception e) { - throw new OssException("涓冪墰浜戝瓨鍌ㄩ厤缃敊璇�! 璇锋鏌ョ郴缁熼厤缃�!"); + throw new OssException("涓冪墰浜戝瓨鍌ㄩ厤缃敊璇�! 璇锋鏌ョ郴缁熼厤缃�:[" + e.getMessage() + "]"); } } @@ -57,7 +56,7 @@ } bucketManager.createBucket(bucketName, properties.getRegion()); } catch (Exception e) { - throw new OssException("鍒涘缓Bucket澶辫触, 璇锋牳瀵逛竷鐗涗簯閰嶇疆淇℃伅"); + throw new OssException("鍒涘缓Bucket澶辫触, 璇锋牳瀵逛竷鐗涗簯閰嶇疆淇℃伅:[" + e.getMessage() + "]"); } } @@ -69,12 +68,13 @@ @Override public UploadResult upload(byte[] data, String path, String contentType) { try { - Response res = uploadManager.put(data, path, token, null, contentType, false); + String token = auth.uploadToken(properties.getBucketName()); + Response res = uploadManager.put(data, path, token, null, contentType, false); if (!res.isOK()) { - throw new RuntimeException("涓婁紶涓冪墰鍑洪敊锛�" + res.toString()); + throw new RuntimeException("涓婁紶涓冪墰鍑洪敊锛�" + res.error); } } catch (Exception e) { - throw new OssException("涓婁紶鏂囦欢澶辫触锛岃鏍稿涓冪墰閰嶇疆淇℃伅"); + throw new OssException("涓婁紶鏂囦欢澶辫触锛岃鏍稿涓冪墰閰嶇疆淇℃伅:[" + e.getMessage() + "]"); } return new UploadResult().setUrl(getEndpointLink() + "/" + path).setFilename(path); } @@ -85,7 +85,7 @@ path = path.replace(getEndpointLink() + "/", ""); Response res = bucketManager.delete(properties.getBucketName(), path); if (!res.isOK()) { - throw new RuntimeException("鍒犻櫎涓冪墰鏂囦欢鍑洪敊锛�" + res.toString()); + throw new RuntimeException("鍒犻櫎涓冪墰鏂囦欢鍑洪敊锛�" + res.error); } } catch (Exception e) { throw new OssException(e.getMessage()); -- Gitblit v1.9.3