diff --git a/hongshu-common/src/main/java/com/hongshu/common/config/OssConfig.java b/hongshu-common/src/main/java/com/hongshu/common/config/OssConfig.java new file mode 100644 index 0000000..1fb1500 --- /dev/null +++ b/hongshu-common/src/main/java/com/hongshu/common/config/OssConfig.java @@ -0,0 +1,22 @@ +package com.hongshu.common.config; + +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Configuration; + +/** + * @author hongshu + */ +@Configuration +@Slf4j +@Data +public class OssConfig { + + /** + * type 上传类型(0:本地 1:七牛云 2:minio) + */ + @Value("${oss.type}") + Integer type; + +} diff --git a/hongshu-server/src/main/java/com/hongshu/server/controller/web/WebOssController.java b/hongshu-server/src/main/java/com/hongshu/server/controller/web/WebOssController.java index 83ff2be..cf6fe5c 100644 --- a/hongshu-server/src/main/java/com/hongshu/server/controller/web/WebOssController.java +++ b/hongshu-server/src/main/java/com/hongshu/server/controller/web/WebOssController.java @@ -25,11 +25,10 @@ public class WebOssController { * 上传文件 * * @param file 文件 - * @param type 上传类型 */ @PostMapping("save/{type}") - public Result save(MultipartFile file, @PathVariable Integer type) { - String path = ossService.save(file, type); + public Result save(MultipartFile file) { + String path = ossService.save(file); return Result.ok(path); } @@ -37,14 +36,13 @@ public class WebOssController { * 批量上传文件 * * @param files 文件集 - * @param type 类型 */ - @PostMapping(value = "saveBatch/{type}") - public Result> saveBatch(@RequestParam("uploadFiles") MultipartFile[] files, @PathVariable Integer type) { + @PostMapping(value = "saveBatch") + public Result> saveBatch(@RequestParam("uploadFiles") MultipartFile[] files) { if (files.length == 0) { return Result.fail(null); } - List stringList = ossService.saveBatch(files, type); + List stringList = ossService.saveBatch(files); return Result.ok(stringList); } @@ -52,11 +50,10 @@ public class WebOssController { * 删除文件 * * @param path 路径 - * @param type 类型 */ - @GetMapping("delete/{type}") - public Result delete(String path, @PathVariable Integer type) { - ossService.delete(path, type); + @GetMapping("delete") + public Result delete(String path) { + ossService.delete(path); return Result.ok(); } @@ -64,14 +61,13 @@ public class WebOssController { * 批量删除文件 * * @param filePaths 文件路径集 - * @param type 类型 */ - @PostMapping(value = "deleteBatch/{type}") - public Result deleteBatch(@RequestBody List filePaths, @PathVariable Integer type) { + @PostMapping(value = "deleteBatch") + public Result deleteBatch(@RequestBody List filePaths) { if (filePaths.isEmpty()) { return Result.fail(null); } - ossService.batchDelete(filePaths, type); + ossService.batchDelete(filePaths); return Result.ok(); } } diff --git a/hongshu-server/src/main/resources/application.yml b/hongshu-server/src/main/resources/application.yml index 460fac9..2afc3ec 100644 --- a/hongshu-server/src/main/resources/application.yml +++ b/hongshu-server/src/main/resources/application.yml @@ -7,7 +7,7 @@ hongshu: # 版权年份 copyrightYear: 2024 # 文件路径 示例( Windows配置 D:/hongshu/uploadPath,Linux配置 /home/hongshu/uploadPath) - profile: /hongshu/uploadPath + profile: /Users/mayongjian/Desktop/hongshu-gitee/hongshu/upload # 获取ip地址开关 addressEnabled: false # 验证码类型 math 数字计算 char 字符验证 @@ -65,6 +65,7 @@ spring: restart: # 热部署开关 enabled: true + # redis 配置 redis: # 地址 @@ -139,16 +140,16 @@ xss: # 匹配链接 urlPatterns: /system/*,/monitor/*,/tool/* -# ES配置 +# ElasticSearch配置 es: url: localhost port: 9200 username: password: -# oss配置 +# Oss配置 oss: - type: 1 # 0:是本地存储,1:是七牛云存储 + type: 0 # 0:是本地存储,1:是七牛云存储 # 七牛云配置 qiNiuYun: diff --git a/hongshu-web/src/main/java/com/hongshu/web/auth/LoginMvcConfigureAdapter.java b/hongshu-web/src/main/java/com/hongshu/web/auth/LoginMvcConfigureAdapter.java index 68d4efe..f2a4d6d 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/auth/LoginMvcConfigureAdapter.java +++ b/hongshu-web/src/main/java/com/hongshu/web/auth/LoginMvcConfigureAdapter.java @@ -1,13 +1,14 @@ package com.hongshu.web.auth; -import com.hongshu.common.constant.UploadFileConstant; +import com.hongshu.common.config.HongshuConfig; +import com.hongshu.common.constant.Constants; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; /** - * @Author hongshu + * @author: hongshu */ @Configuration public class LoginMvcConfigureAdapter extends WebMvcConfigurationSupport { @@ -31,8 +32,12 @@ public class LoginMvcConfigureAdapter extends WebMvcConfigurationSupport { */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { - registry.addResourceHandler(UploadFileConstant.OSS + "/**") //虚拟url路径 - .addResourceLocations("file:" + UploadFileConstant.ADDRESS); //真实本地路径 - super.addResourceHandlers(registry); +// registry.addResourceHandler(UploadFileConstant.OSS + "/**") //虚拟url路径 +// .addResourceLocations("file:" + UploadFileConstant.ADDRESS); //真实本地路径 +// super.addResourceHandlers(registry); + + /** 本地文件上传路径 */ + registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") + .addResourceLocations("file:" + HongshuConfig.getProfile() + "/"); } } diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/IWebOssService.java b/hongshu-web/src/main/java/com/hongshu/web/service/IWebOssService.java index 5eee4bf..6903999 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/IWebOssService.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/IWebOssService.java @@ -15,31 +15,27 @@ public interface IWebOssService { * 上传文件 * * @param file 文件 - * @param type 上传类型 */ - String save(MultipartFile file, Integer type); + String save(MultipartFile file); /** * 批量上传文件 * * @param files 文件集 - * @param type 类型 */ - List saveBatch(MultipartFile[] files, Integer type); + List saveBatch(MultipartFile[] files); /** * 删除文件 * * @param path 路径 - * @param type 类型 */ - void delete(String path, Integer type); + void delete(String path); /** * 批量删除文件 * * @param filePaths 文件路径集 - * @param type 类型 */ - void batchDelete(List filePaths, Integer type); + void batchDelete(List filePaths); } diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysMemberServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysMemberServiceImpl.java index 52bc075..5b52d4a 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysMemberServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysMemberServiceImpl.java @@ -15,7 +15,6 @@ import com.hongshu.web.service.IWebOssService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -36,8 +35,6 @@ public class SysMemberServiceImpl implements ISysMemberService { private SysMemberMapper memberMapper; @Autowired private IWebOssService ossService; - @Value("${oss.type}") - Integer type; /** @@ -85,7 +82,7 @@ public class SysMemberServiceImpl implements ISysMemberService { public int insertMember(WebUser user, MultipartFile file) { // 上传头像 if (ObjectUtils.isNotEmpty(file)) { - String avatar = ossService.save(file, type); + String avatar = ossService.save(file); user.setAvatar(avatar); } user.setHsId(Long.valueOf(RandomUtil.randomNumbers(10))); @@ -108,7 +105,7 @@ public class SysMemberServiceImpl implements ISysMemberService { WebUser webUser = memberMapper.selectById(user.getId()); // 更新头像 if (ObjectUtils.isNotEmpty(file)) { - String avatar = ossService.save(file, type); + String avatar = ossService.save(file); user.setAvatar(avatar); } String newPassword = webUser.getPassword(); diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNavbarServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNavbarServiceImpl.java index 75e07e6..bfbba67 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNavbarServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNavbarServiceImpl.java @@ -9,7 +9,6 @@ import com.hongshu.web.service.ISysNavbarService; import com.hongshu.web.service.IWebOssService; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -31,8 +30,6 @@ public class SysNavbarServiceImpl implements ISysNavbarService { private IWebOssService ossService; @Autowired private SysNavbarMapper navbarMapper; - @Value("${oss.type}") - Integer type; /** @@ -81,7 +78,7 @@ public class SysNavbarServiceImpl implements ISysNavbarService { */ @Override public int insertNavbar(WebNavbar category, MultipartFile file) { - String normalCover = ossService.save(file, type); + String normalCover = ossService.save(file); category.setNormalCover(normalCover); category.setCreator("system"); category.setCreateTime(new Date()); @@ -98,7 +95,7 @@ public class SysNavbarServiceImpl implements ISysNavbarService { @Override public int updateNavbar(WebNavbar category, MultipartFile file) { if (ObjectUtils.isNotEmpty(file)) { - String normalCover = ossService.save(file, type); + String normalCover = ossService.save(file); category.setNormalCover(normalCover); } category.setUpdater("system"); diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNoteServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNoteServiceImpl.java index 51ca1a9..d9ea502 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNoteServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/SysNoteServiceImpl.java @@ -13,16 +13,15 @@ import com.hongshu.web.domain.entity.WebNavbar; import com.hongshu.web.domain.entity.WebNote; import com.hongshu.web.domain.entity.WebUser; import com.hongshu.web.domain.vo.NoteSearchVO; -import com.hongshu.web.mapper.WebUserMapper; import com.hongshu.web.mapper.SysNavbarMapper; import com.hongshu.web.mapper.SysNoteMapper; +import com.hongshu.web.mapper.WebUserMapper; import com.hongshu.web.service.ISysNoteService; import com.hongshu.web.service.IWebEsNoteService; import com.hongshu.web.service.IWebOssService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -49,8 +48,6 @@ public class SysNoteServiceImpl implements ISysNoteService { private SysNavbarMapper navbarMapper; @Autowired private IWebOssService ossService; - @Value("${oss.type}") - Integer type; /** @@ -118,7 +115,7 @@ public class SysNoteServiceImpl implements ISysNoteService { public int insertNote(WebNote note, MultipartFile file) { // 上传头像 if (ObjectUtils.isNotEmpty(file)) { - String noteCover = ossService.save(file, type); + String noteCover = ossService.save(file); note.setNoteCover(noteCover); } note.setCreator("System"); @@ -136,7 +133,7 @@ public class SysNoteServiceImpl implements ISysNoteService { public int updateNote(WebNote note, MultipartFile file) { // 上传头像 if (ObjectUtils.isNotEmpty(file)) { - String noteCover = ossService.save(file, type); + String noteCover = ossService.save(file); note.setNoteCover(noteCover); } note.setUpdater("System"); diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebChatServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebChatServiceImpl.java index a5ca6b1..232c539 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebChatServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebChatServiceImpl.java @@ -97,8 +97,7 @@ public class WebChatServiceImpl extends ServiceImpl impl */ @Override public List getChatUserList() { - String currentUid = WebUtils.getRequestHeader(UserConstant.USER_ID); -// String currentUid = AuthContextHolder.getUserId(); + String currentUid = AuthContextHolder.getUserId(); List result = new ArrayList<>(); List chatUserRelationList = chatUserRelationMapper.selectList(new QueryWrapper().eq("accept_uid", currentUid).orderByDesc("timestamp")); if (chatUserRelationList.isEmpty()) { diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebCommentServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebCommentServiceImpl.java index 93db1ea..17ec4fb 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebCommentServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebCommentServiceImpl.java @@ -187,8 +187,7 @@ public class WebCommentServiceImpl extends ServiceImpl getNoticeComment(long currentPage, long pageSize) { Page result = new Page<>(); - String currentUid = WebUtils.getRequestHeader(UserConstant.USER_ID); -// String currentUid = AuthContextHolder.getUserId(); + String currentUid = AuthContextHolder.getUserId(); Page commentPage = this.page(new Page<>((int) currentPage, (int) pageSize), new QueryWrapper().or(e -> e.eq("note_uid", currentUid).or().eq("reply_uid", currentUid)).ne("uid", currentUid).orderByDesc("create_time")); diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebFollowServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebFollowServiceImpl.java index c93caae..a77136b 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebFollowServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebFollowServiceImpl.java @@ -52,8 +52,7 @@ public class WebFollowServiceImpl extends ServiceImpl getFollowTrend(long currentPage, long pageSize) { Page page = new Page<>(); // 得到当前用户所有关注的用户 - String currentUid = WebUtils.getRequestHeader(UserConstant.USER_ID); -// String currentUid = AuthContextHolder.getUserId(); + String currentUid = AuthContextHolder.getUserId(); List followers = this.list(new QueryWrapper().eq("uid", currentUid)); List fids = followers.stream().map(WebFollow::getFid).collect(Collectors.toList()); fids.add(currentUid); @@ -107,7 +106,7 @@ public class WebFollowServiceImpl extends ServiceImpl getFollowList(long currentPage, long pageSize) { Page page = new Page<>(); - String currentUid = WebUtils.getRequestHeader(UserConstant.USER_ID); + String currentUid = AuthContextHolder.getUserId(); List followers = this.list(new QueryWrapper().eq("uid", currentUid)); List fids = followers.stream().map(WebFollow::getFid).collect(Collectors.toList()); Page notePage = noteMapper.selectPage(new Page<>((int) currentPage, (int) pageSize), diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebLikeOrCollectServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebLikeOrCollectServiceImpl.java index 1839f0d..bb24560 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebLikeOrCollectServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebLikeOrCollectServiceImpl.java @@ -97,8 +97,7 @@ public class WebLikeOrCollectServiceImpl extends ServiceImpl getNoticeLikeOrCollection(long currentPage, long pageSize) { Page result = new Page<>(); - String currentUid = WebUtils.getRequestHeader(UserConstant.USER_ID); -// String currentUid = AuthContextHolder.getUserId(); + String currentUid = AuthContextHolder.getUserId(); Page likeOrCollectionPage = this.page(new Page<>((int) currentPage, (int) pageSize), new QueryWrapper().eq("publish_uid", currentUid).ne("uid", currentUid).orderByDesc("create_time")); List likeOrCollectionList = likeOrCollectionPage.getRecords(); diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebNoteServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebNoteServiceImpl.java index fc24443..50336d7 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebNoteServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebNoteServiceImpl.java @@ -5,9 +5,11 @@ import cn.hutool.json.JSONUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.hongshu.common.constant.UserConstant; import com.hongshu.common.enums.ResultCodeEnum; import com.hongshu.common.exception.web.HongshuException; import com.hongshu.common.utils.ConvertUtils; +import com.hongshu.common.utils.WebUtils; import com.hongshu.web.auth.AuthContextHolder; import com.hongshu.web.domain.dto.NoteDTO; import com.hongshu.web.domain.entity.*; @@ -17,7 +19,6 @@ import com.hongshu.web.mapper.WebUserMapper; import com.hongshu.web.service.*; import org.jetbrains.annotations.NotNull; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; @@ -58,9 +59,6 @@ public class WebNoteServiceImpl extends ServiceImpl impl @Autowired WebNoteMapper noteMapper; - @Value("${oss.type}") - Integer type; - @NotNull private StringBuilder getTags(WebNote note, NoteDTO noteDTO) { @@ -164,7 +162,7 @@ public class WebNoteServiceImpl extends ServiceImpl impl // 批量上传图片 List dataList = null; try { - dataList = ossService.saveBatch(files, type); + dataList = ossService.saveBatch(files); } catch (Exception e) { log.error("图片上传失败"); e.printStackTrace(); @@ -195,7 +193,7 @@ public class WebNoteServiceImpl extends ServiceImpl impl for (Object o : array) { pathArr.add((String) o); } - ossService.batchDelete(pathArr, type); + ossService.batchDelete(pathArr); // TODO 可以使用多线程优化, // 删除点赞图片,评论,标签关系,收藏关系 likeOrCollectionService.remove(new QueryWrapper().eq("like_or_collection_id", noteId)); @@ -229,7 +227,7 @@ public class WebNoteServiceImpl extends ServiceImpl impl WebNavbar parentCategory = categoryService.getById(note.getCpid()); List dataList = null; try { - dataList = ossService.saveBatch(files, type); + dataList = ossService.saveBatch(files); } catch (Exception e) { e.printStackTrace(); } @@ -241,7 +239,7 @@ public class WebNoteServiceImpl extends ServiceImpl impl for (Object o : array) { pathArr.add((String) o); } - ossService.batchDelete(pathArr, type); + ossService.batchDelete(pathArr); String[] urlArr = Objects.requireNonNull(dataList).toArray(new String[dataList.size()]); String newUrls = JSONUtil.toJsonStr(urlArr); @@ -285,7 +283,7 @@ public class WebNoteServiceImpl extends ServiceImpl impl note.setPinned("0"); } else { List noteList = this.list(new QueryWrapper().eq("uid", currentUid)); - long count = noteList.stream().filter(item -> "1".equals(item.getPinned()) ).count(); + long count = noteList.stream().filter(item -> "1".equals(item.getPinned())).count(); if (count >= 3) { throw new HongshuException("最多只能置顶3个笔记"); } diff --git a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebOssServiceImpl.java b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebOssServiceImpl.java index 5761cff..9d991e9 100644 --- a/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebOssServiceImpl.java +++ b/hongshu-web/src/main/java/com/hongshu/web/service/impl/WebOssServiceImpl.java @@ -1,9 +1,14 @@ package com.hongshu.web.service.impl; +import com.hongshu.common.config.HongshuConfig; +import com.hongshu.common.config.OssConfig; import com.hongshu.common.utils.MinioUtil; import com.hongshu.common.utils.QiniuUtil; +import com.hongshu.common.utils.file.FileUploadUtils; +import com.hongshu.common.utils.file.MimeTypeUtils; import com.hongshu.web.service.IWebOssService; import com.hongshu.web.websocket.factory.OssFactory; +import lombok.SneakyThrows; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; @@ -23,51 +28,45 @@ public class WebOssServiceImpl implements IWebOssService { QiniuUtil qiniuUtil; @Autowired MinioUtil minioUtil; + @Autowired + private OssConfig ossConfig; /** * 上传文件 * * @param file 文件 - * @param type 上传类型(0:本地 1:七牛云 2:minio) */ + @SneakyThrows @Override - public String save(MultipartFile file, Integer type) { - OssFactory factory = null; + public String save(MultipartFile file) { + Integer type = ossConfig.getType(); switch (type) { case 0: - // 本地上传图片 - factory = new UploadFileToLoacl(); - break; + // 本地存储 + return FileUploadUtils.upload(HongshuConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION); case 1: - // 七牛云 - factory = new QiNiuYunUploadFile(); -// qiniuUtil.uploadQiniu(); - break; + // 七牛云存储 + OssFactory qiniuFactory = new QiNiuYunUploadFile(); + return qiniuFactory.save(file); case 2: - // Minio -// minioUtil.uploadFile(file); - break; + // Minio存储 + return minioUtil.uploadFile(file); default: - break; - } - if (factory != null) { - return factory.save(file); + throw new IllegalArgumentException("不支持的存储类型: " + type); } - return null; } /** * 批量上传文件 * * @param files 文件集 - * @param type 类型 */ @Override - public List saveBatch(MultipartFile[] files, Integer type) { + public List saveBatch(MultipartFile[] files) { List result = new ArrayList<>(); // 需要进行加锁,不然会出现多次添加 for (MultipartFile file : files) { - result.add(this.save(file, type)); + result.add(this.save(file)); } return result; } @@ -76,11 +75,11 @@ public class WebOssServiceImpl implements IWebOssService { * 删除文件 * * @param path 路径 - * @param type 类型 */ @Override - public void delete(String path, Integer type) { + public void delete(String path) { OssFactory factory = null; + Integer type = ossConfig.getType(); switch (type) { case 0: // 本地上传图片 @@ -99,12 +98,11 @@ public class WebOssServiceImpl implements IWebOssService { * 批量删除文件 * * @param filePaths 文件路径集 - * @param type 类型 */ @Override - public void batchDelete(List filePaths, Integer type) { + public void batchDelete(List filePaths) { for (String path : filePaths) { - delete(path, type); + delete(path); } } }