src/main/java/cc/mrbird/febs/common/utils/OssUtils.java
@@ -10,10 +10,10 @@ @Slf4j public class OssUtils { private static String END_POINT = "https://oss-cn-hangzhou.aliyuncs.com"; private static String ACCESS_KEY_ID = "LTAI5tCH5Ld2n72QmF1A2zXm"; private static String ACCESS_KEY_SECRET = "RNIf3J90mV1WdbgraesLusjF7TRRb9"; private static String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com"; public static String END_POINT = "img-1283768017073373.oss-cn-heyuan.oss-accesspoint.aliyuncs.com"; public static String ACCESS_KEY_ID = "LTAI5tJdwRA8VukNC1Ngay2D"; public static String ACCESS_KEY_SECRET = "QjKETu9WzVJQ7D16Vj8oT4euWfuMTX"; public static String bucket_name = "yinheshujie"; public static boolean uploadFileWithBase64(String base64, String pathName) { ByteArrayInputStream stream = null; @@ -22,7 +22,7 @@ BASE64Decoder decoder = new BASE64Decoder(); byte[] bytes = decoder.decodeBuffer(base64); stream = new ByteArrayInputStream(bytes); ossClient.putObject("excoin", pathName, stream); ossClient.putObject(bucket_name, pathName, stream); return true; } catch (Exception e) { log.error("#上传失败:{}#", e); src/main/java/cc/mrbird/febs/mall/controller/CommonController.java
@@ -264,9 +264,9 @@ String base64Str = java.util.Base64.getEncoder().encodeToString(fileBytes); String imageSuffix = "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageSuffix; String imageName = "clothes/" + imageNames; String imageName = "xcx/" + imageNames; OssUtils.uploadFileWithBase64(base64Str, imageName); String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com"; String bucket_name = OssUtils.END_POINT; String url = bucket_name + "/" + imageName; Map<String,Object> map = new HashMap<String,Object>(); @@ -293,9 +293,9 @@ String imageFuffix = ".jpg"; String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageFuffix; String imageName = "clothes/" + imageNames; String imageName = "xcx/" + imageNames; OssUtils.uploadFileWithBase64(base64Str, imageName); String bucket_name ="https://excoin.oss-cn-hangzhou.aliyuncs.com"; String bucket_name = OssUtils.END_POINT; String url = bucket_name + "/" + imageName; return new FebsResponse().message("上传成功").success().data(url); src/main/java/cc/mrbird/febs/mall/controller/goods/AdminMallGoodsController.java
@@ -130,9 +130,9 @@ String base64Str = java.util.Base64.getEncoder().encodeToString(fileBytes); String imageSuffix = "." + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1); String imageNames = System.currentTimeMillis() + IdUtil.simpleUUID() + imageSuffix; String imageName = "clothes/" + imageNames; String imageName = "xcx/" + imageNames; OssUtils.uploadFileWithBase64(base64Str, imageName); String bucket_name = "https://excoin.oss-cn-hangzhou.aliyuncs.com"; String bucket_name = OssUtils.END_POINT; String url = bucket_name + "/" + imageName; Map<String,Object> map = new HashMap<String,Object>();