From 431ce8ac2802407bac229ff5e689ef7c92e8bb39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Fri, 16 Oct 2020 14:29:39 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=E7=A9=BA=E5=80=BC?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=EF=BC=8C=E5=AE=8C=E5=96=84=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/fileserviceimpl/QiniuFileServiceImpl.java | 8 ++++---- src/main/resources/application-test.properties | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/cn/celess/blog/service/fileserviceimpl/QiniuFileServiceImpl.java b/src/main/java/cn/celess/blog/service/fileserviceimpl/QiniuFileServiceImpl.java index 56e9f6a..7352fa1 100644 --- a/src/main/java/cn/celess/blog/service/fileserviceimpl/QiniuFileServiceImpl.java +++ b/src/main/java/cn/celess/blog/service/fileserviceimpl/QiniuFileServiceImpl.java @@ -66,8 +66,8 @@ public class QiniuFileServiceImpl implements FileManager { StringMap stringMap = response.jsonToMap(); fileResponse.key = (String) stringMap.get("key"); - fileResponse.bucket = (String) stringMap.get("bucket"); - fileResponse.size = (long) stringMap.get("fsize"); + fileResponse.bucket = "qiniu"; + fileResponse.size = 0; fileResponse.hash = (String) stringMap.get("hash"); return fileResponse; @@ -103,9 +103,9 @@ public class QiniuFileServiceImpl implements FileManager { @SneakyThrows @Override public boolean deleteFile(String fileName) { + init(); Response response = bucketManager.delete(bucket, fileName); - - return false; + return "".equals(response.bodyString()); } private boolean continueFile(String key) { diff --git a/src/main/resources/application-test.properties b/src/main/resources/application-test.properties index 7f8f605..12e4f1b 100644 --- a/src/main/resources/application-test.properties +++ b/src/main/resources/application-test.properties @@ -1,9 +1,9 @@ server.port=8081 # 七牛的密钥配置 -qiniu.accessKey= -qiniu.secretKey= -qiniu.bucket= +qiniu.accessKey=${QINIU_ACCESSKEY:null} +qiniu.secretKey=${QINIU_SECRETKEY:null} +qiniu.bucket=xiaohai # sitemap 存放地址 sitemap.path= # 生成JWT时候的密钥