|
|
@@ -7,6 +7,7 @@ import lombok.AllArgsConstructor;
|
|
|
import lombok.SneakyThrows;
|
|
|
import net.coobird.thumbnailator.Thumbnails;
|
|
|
import org.springblade.common.enums.CommonEnum;
|
|
|
+import org.springblade.common.enums.UrlEnum;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.oss.model.OssFile;
|
|
|
import org.springblade.core.tenant.annotation.NonDS;
|
|
|
@@ -148,10 +149,6 @@ public class OssEndpoint {
|
|
|
@SneakyThrows
|
|
|
@PostMapping("/put-file")
|
|
|
public R<BladeFile> putFile(@RequestParam("file") MultipartFile file) {
|
|
|
- String status = sysClient.getParamService("upload.url");
|
|
|
- String replaceUrl = sysClient.getParamService("replace.url");
|
|
|
- System.err.println("upload.url:" + status);
|
|
|
- System.err.println("replace.url:" + replaceUrl);
|
|
|
String contentType = file.getContentType();
|
|
|
BladeFile bladeFile;
|
|
|
if (this.CONTENT_TYPE.contains(contentType) && file.getSize() > this.MAX_IMAGE_SIZE) {
|
|
|
@@ -164,16 +161,7 @@ public class OssEndpoint {
|
|
|
bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
|
|
|
}
|
|
|
String link = bladeFile.getLink();
|
|
|
- System.err.println("link:" + link);
|
|
|
- //String replace = link.replace("http://121.37.83.47:9000/", "https://trade.tubaosoft.com/file/");
|
|
|
- String replace = "";
|
|
|
- if (!Objects.equals(status, CommonEnum.GET_DATA_FAIL.info)) {
|
|
|
- replace = Objects.equals(replaceUrl, CommonEnum.GET_DATA_FAIL.info) ? link.replace(status, replaceUrl + "/file") : link.replace(status + ":9000/", status + "/file/");
|
|
|
- } else {
|
|
|
- // todo: 需要修改
|
|
|
- replace = link.replace("http://121.37.83.47:9000/", "https://lt.echepei.com/file/");
|
|
|
- }
|
|
|
- System.err.println("replace:" + replace);
|
|
|
+ String replace = link.replace(UrlEnum.INTERNAL_NETWORK_ADDRESS.url, UrlEnum.EXTERNAL_NETWORK_ADDRESS.url);
|
|
|
bladeFile.setLink(replace);
|
|
|
return R.data(bladeFile);
|
|
|
}
|