zhanghua
2025-03-04 b8d8733ad9eeeb170a71897d1078acdbea7680f2
ycl-common/src/main/java/com/ycl/service/oss/impl/OssServiceImpl.java
@@ -154,7 +154,9 @@
    }
    @Override
    public boolean deleteImages(String fileUrl) throws UnsupportedEncodingException {
    public boolean deleteImages(String fileUrl) {
        try {
        String endpoint = ConstantPropertiesUtils.END_POINT;
        String accessKeyId = ConstantPropertiesUtils.ACCESS_KEY_ID;
        String accessKeySecret = ConstantPropertiesUtils.ACCESS_KEY_SECRET;
@@ -167,7 +169,12 @@
        if (imgFile.contains("?")) {
            fileName = imgFile.substring(0, imgFile.indexOf("?"));
        }
            try {
        fileName = URLDecoder.decode(fileName, "UTF-8");
            } catch (UnsupportedEncodingException ex) {
//                throw new RuntimeException(ex);
            }
        // 根据BucketName,objectName删除文件
        boolean b = ossClient.doesObjectExist(bucketName, fileName);
@@ -177,6 +184,11 @@
        }
        ossClient.shutdown();
        return true;
        } catch (Exception e) {
            System.out.println("-------删除图片失败,图片地址:" + fileUrl);
        }
        return false;
    }
    @Override