修复存储引擎编辑异常

This commit is contained in:
TinyAnts 2022-06-24 10:42:26 +08:00
parent 2f7361c2dd
commit 52d2aa793f
4 changed files with 12 additions and 10 deletions

View File

@ -70,8 +70,8 @@ public class SettingStorageServiceImpl implements ISettingStorageService {
map.put("status", engine.equals(alias) ? 1 : 0);
if (!alias.equals("local")) {
map.put("bucket", config.getOrDefault("bucket", ""));
map.put("secretKey", config.getOrDefault("secret_key", ""));
map.put("accessKey", config.getOrDefault("access_key", ""));
map.put("secretKey", config.getOrDefault("secretKey", ""));
map.put("accessKey", config.getOrDefault("accessKey", ""));
map.put("domain", config.getOrDefault("domain", ""));
if (alias.equals("qcloud")) {
map.put("region", config.getOrDefault("region", ""));
@ -92,7 +92,8 @@ public class SettingStorageServiceImpl implements ISettingStorageService {
Assert.notNull(params.get("alias"), "alias参数缺失");
Assert.notNull(params.get("status"), "status参数缺失");
Map<String, String> map = new LinkedHashMap<>();
System.out.println("斤斤计较");
System.out.println(params);
map.put("name", "本地存储");
if (!params.get("alias").equals("local")) {
map.put("bucket", params.getOrDefault("bucket", ""));
@ -113,8 +114,9 @@ public class SettingStorageServiceImpl implements ISettingStorageService {
}
}
String engine = ConfigUtil.get("storage", "default", "local");
ConfigUtil.set("storage", params.get("alias"), JSON.toJSONString(map));
String engine = ConfigUtil.get("storage", "default", "local");
if (Integer.parseInt(params.get("status")) == 1) {
ConfigUtil.set("storage", "default", params.get("alias"));
} else if (engine.equals(params.get("alias")) && Integer.parseInt(params.get("status")) == 0) {

View File

@ -35,8 +35,8 @@ public class AliyunStorage {
*/
public OSS ossClient() {
String endpoint = "https://oss-cn-shenzhen.aliyuncs.com";
String accessKeyId = this.config.get("access_key");
String accessKeySecret = this.config.get("secret_key");
String accessKeyId = this.config.get("accessKey");
String accessKeySecret = this.config.get("secretKey");
return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
}

View File

@ -39,8 +39,8 @@ public class QcloudStorage {
* @return String
*/
public COSClient cosClient() {
String secretId = this.config.get("access_key");
String secretKey = this.config.get("secret_key");
String secretId = this.config.get("accessKey");
String secretKey = this.config.get("secretKey");
COSCredentials cred = new BasicCOSCredentials(secretId, secretKey);
Region region = new Region(this.config.get("region"));
ClientConfig clientConfig = new ClientConfig(region);

View File

@ -37,8 +37,8 @@ public class QiniuStorage {
* @return String
*/
public String upToken() {
String accessKey = this.config.get("access_key");
String secretKey = this.config.get("secret_key");
String accessKey = this.config.get("accessKey");
String secretKey = this.config.get("secretKey");
String bucket = this.config.get("bucket");
Auth auth = Auth.create(accessKey, secretKey);
return auth.uploadToken(bucket);