From 1c8d44b3094b0f0bae18abeb5fffc8b59c50f9b7 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 17 十一月 2021 10:45:32 +0800 Subject: [PATCH] update 监控中心 集成监控客户端 实现自监控 --- ruoyi-oss/src/main/java/com/ruoyi/oss/service/impl/QiniuCloudStorageStrategy.java | 12 ++++++------ 1 files changed, 6 insertions(+), 6 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 e9b8dc0..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,9 +35,8 @@ 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)) { @@ -69,9 +68,10 @@ @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("涓婁紶鏂囦欢澶辫触锛岃鏍稿涓冪墰閰嶇疆淇℃伅:[" + e.getMessage() + "]"); @@ -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