yonge vor 5 Jahren
Ursprung
Commit
c533eb477c

+ 9 - 1
edu-thirdparty/src/main/java/com/keao/edu/thirdparty/storage/provider/KS3StoragePlugin.java

@@ -3,6 +3,7 @@ package com.keao.edu.thirdparty.storage.provider;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.util.IOUtils;
 import org.springframework.beans.factory.DisposableBean;
 import org.springframework.beans.factory.InitializingBean;
@@ -39,6 +40,9 @@ public class KS3StoragePlugin implements StoragePlugin, InitializingBean, Dispos
 
 	@Value("${storage.oss.bucketName:daya}")
 	private String bucketName;
+	
+	@Value("${storage.oss.endpoint:cdn.colexiu.com}")
+	private String cdnEndpoint;
 
 	private Ks3 client;
 
@@ -89,7 +93,11 @@ public class KS3StoragePlugin implements StoragePlugin, InitializingBean, Dispos
 
 		client.putObject(request);
 
-		return "https://" + bucketName + "." + endpoint + "/" + folderName + "/" + file.getName();
+		if (StringUtils.isBlank(cdnEndpoint)) {
+			return "https://" + bucketName + "." + endpoint + "/" + folderName + "/" + file.getName();
+		} else {
+			return "https://" + cdnEndpoint + "/" + folderName + "/" + file.getName();
+		}
 	}
 
 	@Override