diff --git a/im-platform/src/main/java/com/bx/implatform/service/thirdparty/FileService.java b/im-platform/src/main/java/com/bx/implatform/service/thirdparty/FileService.java index 7fdb640..c3541a7 100644 --- a/im-platform/src/main/java/com/bx/implatform/service/thirdparty/FileService.java +++ b/im-platform/src/main/java/com/bx/implatform/service/thirdparty/FileService.java @@ -19,10 +19,12 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.PostConstruct; import java.io.IOException; -/* +/** + * todo 通过校验文件MD5实现重复文件秒传 * 文件上传服务 * @Author Blue * @Date 2022/10/28 + * */ @Slf4j @Service @@ -87,11 +89,13 @@ public class FileService { throw new GlobalException(ResultCode.PROGRAM_ERROR,"图片上传失败"); } vo.setOriginUrl(generUrl(FileType.IMAGE,fileName)); - // 上传缩略图 - byte[] imageByte = ImageUtil.compressForScale(file.getBytes(),100); - fileName = minioUtil.upload(bucketName,imagePath,file.getOriginalFilename(),imageByte,file.getContentType()); - if(StringUtils.isEmpty(fileName)){ - throw new GlobalException(ResultCode.PROGRAM_ERROR,"图片上传失败"); + // 大于30K的文件需上传缩略图 + if(file.getSize() > 30 * 1024){ + byte[] imageByte = ImageUtil.compressForScale(file.getBytes(),30); + fileName = minioUtil.upload(bucketName,imagePath,file.getOriginalFilename(),imageByte,file.getContentType()); + if(StringUtils.isEmpty(fileName)){ + throw new GlobalException(ResultCode.PROGRAM_ERROR,"图片上传失败"); + } } vo.setThumbUrl(generUrl(FileType.IMAGE,fileName)); log.info("文件图片成功,用户id:{},url:{}",userId,vo.getOriginUrl()); diff --git a/im-ui/src/view/Home.vue b/im-ui/src/view/Home.vue index f6c0bf4..3cddad3 100644 --- a/im-ui/src/view/Home.vue +++ b/im-ui/src/view/Home.vue @@ -29,12 +29,6 @@ - - - - - -