mirror of
https://gitee.com/likeadmin/likeadmin_java.git
synced 2026-05-12 11:25:38 +08:00
修复上传报错bug
This commit is contained in:
@@ -7,6 +7,7 @@ import com.hxkj.common.plugin.storage.engine.LocalStorage;
|
||||
import com.hxkj.common.plugin.storage.engine.QcloudStorage;
|
||||
import com.hxkj.common.plugin.storage.engine.QiniuStorage;
|
||||
import com.hxkj.common.utils.ConfigUtil;
|
||||
import com.hxkj.common.utils.StringUtil;
|
||||
import com.hxkj.common.utils.TimeUtil;
|
||||
import com.hxkj.common.utils.UrlUtil;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -30,7 +31,14 @@ public class StorageDriver {
|
||||
*/
|
||||
public StorageDriver() {
|
||||
this.engine = ConfigUtil.get("storage", "default", "local");
|
||||
this.config = ConfigUtil.getMap("storage", this.engine);
|
||||
|
||||
Map<String, String> config1;
|
||||
config1 = ConfigUtil.getMap("storage", this.engine);
|
||||
if (config1 == null) {
|
||||
config1 = new HashMap<>();
|
||||
}
|
||||
|
||||
this.config = config1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,9 +37,9 @@ public class QiniuStorage {
|
||||
* @return String
|
||||
*/
|
||||
public String upToken() {
|
||||
String accessKey = this.config.get("accessKey");
|
||||
String secretKey = this.config.get("secretKey");
|
||||
String bucket = this.config.get("bucket");
|
||||
String accessKey = this.config.getOrDefault("accessKey", "");
|
||||
String secretKey = this.config.getOrDefault("secretKey", "");
|
||||
String bucket = this.config.getOrDefault("bucket", "");
|
||||
Auth auth = Auth.create(accessKey, secretKey);
|
||||
return auth.uploadToken(bucket);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,11 @@ public class ConfigUtil {
|
||||
.eq("type", type)
|
||||
.eq("name", name));
|
||||
|
||||
if (config.getValue().equals("") || config.getValue().equals("[]")) {
|
||||
if (config == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (config.getValue().equals("") || config.getValue().equals("[]") || config.getValue().equals("{}")) {
|
||||
return new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user