修复存储引擎编辑异常

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); map.put("status", engine.equals(alias) ? 1 : 0);
if (!alias.equals("local")) { if (!alias.equals("local")) {
map.put("bucket", config.getOrDefault("bucket", "")); map.put("bucket", config.getOrDefault("bucket", ""));
map.put("secretKey", config.getOrDefault("secret_key", "")); map.put("secretKey", config.getOrDefault("secretKey", ""));
map.put("accessKey", config.getOrDefault("access_key", "")); map.put("accessKey", config.getOrDefault("accessKey", ""));
map.put("domain", config.getOrDefault("domain", "")); map.put("domain", config.getOrDefault("domain", ""));
if (alias.equals("qcloud")) { if (alias.equals("qcloud")) {
map.put("region", config.getOrDefault("region", "")); 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("alias"), "alias参数缺失");
Assert.notNull(params.get("status"), "status参数缺失"); Assert.notNull(params.get("status"), "status参数缺失");
Map<String, String> map = new LinkedHashMap<>(); Map<String, String> map = new LinkedHashMap<>();
System.out.println("斤斤计较");
System.out.println(params);
map.put("name", "本地存储"); map.put("name", "本地存储");
if (!params.get("alias").equals("local")) { if (!params.get("alias").equals("local")) {
map.put("bucket", params.getOrDefault("bucket", "")); 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)); ConfigUtil.set("storage", params.get("alias"), JSON.toJSONString(map));
String engine = ConfigUtil.get("storage", "default", "local");
if (Integer.parseInt(params.get("status")) == 1) { if (Integer.parseInt(params.get("status")) == 1) {
ConfigUtil.set("storage", "default", params.get("alias")); ConfigUtil.set("storage", "default", params.get("alias"));
} else if (engine.equals(params.get("alias")) && Integer.parseInt(params.get("status")) == 0) { } 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() { public OSS ossClient() {
String endpoint = "https://oss-cn-shenzhen.aliyuncs.com"; String endpoint = "https://oss-cn-shenzhen.aliyuncs.com";
String accessKeyId = this.config.get("access_key"); String accessKeyId = this.config.get("accessKey");
String accessKeySecret = this.config.get("secret_key"); String accessKeySecret = this.config.get("secretKey");
return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret); return new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);
} }

View File

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

View File

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