Browse Source

将获取文件的接口做额外的处理

Yangzw 1 month ago
parent
commit
726da988c7

+ 9 - 8
feifan-module-infra/feifan-module-infra-biz/src/main/java/cn/newfeifan/mall/module/infra/controller/admin/file/FileController.java

@@ -62,7 +62,7 @@ public class FileController {
     @GetMapping("/{configId}/get/**")
     @PermitAll
     @Operation(summary = "下载文件")
-    @Parameter(name = "configId", description = "配置编号",  required = true)
+    @Parameter(name = "configId", description = "配置编号", required = true)
     public void getFileContent(HttpServletRequest request,
                                HttpServletResponse response,
                                @PathVariable("configId") Long configId) throws Exception {
@@ -81,13 +81,14 @@ public class FileController {
             response.setStatus(HttpStatus.NOT_FOUND.value());
             return;
         }
-        if(path.contains("mp4")){
-            String range = request.getHeader("Range");
-            System.out.println("========Range:" + range);
-            ServletUtils.transfer(content, range,response);
-        } else {
-        ServletUtils.writeAttachment(response, path, content,request);
-        }
+//        if(path.contains("mp4")){
+//            String range = request.getHeader("Range");
+//            System.out.println("========Range:" + range);
+//            ServletUtils.transfer(content, range, response);
+//        } else {
+//        }
+        System.out.println("===============开始获取文件");
+            ServletUtils.writeAttachment(response, path, content, request);
     }
 
     @GetMapping("/page")