From a2d81eff7490d9ef2e5fb45727ad86f7770c55cd Mon Sep 17 00:00:00 2001
From: feige <feige@qq.com>
Date: 星期一, 05 一月 2026 15:08:03 +0800
Subject: [PATCH] Merge branch 'master' of http://47.93.189.255:8099/r/zhangshi_app_backend

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java |   61 ++++++++++++++----------------
 1 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
index 4a03034..1e6e1d1 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -24,6 +24,7 @@
 import com.ruoyi.common.annotation.Anonymous;
 import com.ruoyi.common.utils.RenamedMultipartFile;
 import com.ruoyi.common.utils.uuid.UUID;
+import com.ruoyi.domain.MediaCompressRequest;
 import com.ruoyi.service.DownLoadFileService;
 import com.ruoyi.service.impl.VideoProcessService;
 import lombok.Data;
@@ -515,47 +516,40 @@
 
     /**
      * 鍘嬬缉鍥剧墖鎴栨彁鍙栬棰戝皝闈㈠苟杩斿洖Base64
-     *
-     * @param file 鍥剧墖鎴栬棰戞枃浠�
-     * @param width 鐩爣瀹藉害锛岄粯璁�100
-     * @param height 鐩爣楂樺害锛岄粯璁�100
-     * @param quality 鍥剧墖璐ㄩ噺 0.1-1.0锛岄粯璁�0.8
+     * @param mediaCompressRequest
+     * 鍖呮嫭
+     *  file 鍥剧墖鎴栬棰戞枃浠�
+     * width 鐩爣瀹藉害锛岄粯璁�100
+     * height 鐩爣楂樺害锛岄粯璁�100
+     *  quality 鍥剧墖璐ㄩ噺 0.1-1.0锛岄粯璁�0.8
      * @return Map鍖呭惈鍘嬬缉缁撴灉鍜孊ase64
      */
     @Anonymous
-    @PostMapping(value = "/images/zip", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
-    public Map<String, Object> compressMediaToBase64(
-        @RequestParam(value = "file", required = false) MultipartFile file,
-        @RequestParam(value = "filePath", required = false) String filePath,
-        @RequestParam(value = "width", defaultValue = "0") int width,
-        @RequestParam(value = "height", defaultValue = "0") int height,
-        @RequestParam(value = "quality", defaultValue = "0.8") float quality) {
+    @PostMapping(value = "/images/zip")
+    public Map<String, Object> compressMediaToBase64(@RequestBody MediaCompressRequest mediaCompressRequest) {
         Map<String, Object> result = new HashMap<>();
 
+        if (mediaCompressRequest == null && mediaCompressRequest.getFilePath() == null){
+            result.put("success", false);
+            result.put("message", "鏂囦欢涓嶈兘涓虹┖");
+            return result;
+        }
+
+        String filePath = mediaCompressRequest.getFilePath();
+        int width = mediaCompressRequest.getWidth();
+        int height = mediaCompressRequest.getHeight();
+        float quality = mediaCompressRequest.getQuality();
+
+        System.out.println("--------------"+mediaCompressRequest);
+
         File trueFile;
-        boolean deleteY = true;
 
         try {
-            // 楠岃瘉鏂囦欢
-            if ((file == null || file.isEmpty()) && filePath == null ) {
-                result.put("success", false);
-                result.put("message", "鏂囦欢涓嶈兘涓虹┖");
-                return result;
-            }
+            String fileUel = RuoYiConfig.getProfile() + filePath.replace("/profile","").replace("profile","");
+            trueFile = new File(fileUel);
 
-            if ((file == null || file.isEmpty())){
-                deleteY = false;
-                String fileUel = RuoYiConfig.getProfile() + filePath.replace("/profile","");
-                trueFile = new File(fileUel);
-            }else {
-                trueFile = videoProcessService.convertToFile(file);
-            }
+
             String fileName = trueFile.getName();
-            if (fileName.isEmpty() && filePath == null) {
-                result.put("success", false);
-                result.put("message", "鏂囦欢鍚嶄笉鑳戒负绌�");
-                return result;
-            }
 
             System.out.println("-----------"+fileName);
 
@@ -566,10 +560,10 @@
             // 鍒ゆ柇鏂囦欢绫诲瀷
             if (isImageFile(extension)) {
                 // 澶勭悊鍥剧墖鏂囦欢
-                return videoProcessService.processImage(trueFile, width, height, quality, extension,deleteY);
+                return videoProcessService.processImage(trueFile, width, height, quality, extension);
             } else if (isVideoFile(extension)) {
                 // 澶勭悊瑙嗛鏂囦欢
-                return videoProcessService.processVideo(trueFile,width,height,quality,extension,deleteY);
+                return videoProcessService.processVideo(trueFile,width,height,quality,extension);
             } else {
                 result.put("success", false);
                 result.put("message", "涓嶆敮鎸佺殑鏂囦欢鏍煎紡锛�" + extension);
@@ -584,6 +578,7 @@
         }
     }
 
+
     /**
      * 鍒ゆ柇鏄惁鏄浘鐗囨枃浠�
      */

--
Gitblit v1.9.1