xiangpei
2025-05-22 0d9214d780c5093165f566f3e6f0c60f5d8aead7
common-api/src/main/java/cn/lili/controller/lmk/LmkFileController.java
@@ -1,6 +1,7 @@
package cn.lili.controller.lmk;
import cn.lili.base.Result;
import cn.lili.modules.lmk.domain.form.FileKey;
import cn.lili.modules.lmk.service.LmkFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -61,10 +62,10 @@
     * @param fileKey oss文件名
     * @return
     */
    @Delete("/delete/{file_key}")
    @Delete("/delete}")
    @ApiOperation(value = "删除某个文件")
    public Result deleteObject(@PathVariable(value = "file_key") String fileKey) {
        return lmkFileService.deleteObject(fileKey);
    public Result deleteObject(@RequestBody FileKey fileKey) {
        return lmkFileService.deleteObject(fileKey.getFileKey());
    }
    /**
@@ -85,10 +86,10 @@
     * @param fileKey
     * @return
     */
    @GetMapping("/download/{file_key}")
    @PostMapping("/download")
    @ApiOperation(value = "下载文件")
    public void downloadFile(@PathVariable(value = "file_key") String fileKey, HttpServletResponse response) {
        lmkFileService.downloadObject(fileKey, response);
    public void downloadFile(@RequestBody FileKey fileKey, HttpServletResponse response) {
        lmkFileService.downloadObject(fileKey.getFileKey(), response);
    }
    /**
@@ -97,10 +98,10 @@
     * @param fileKey
     * @return
     */
    @GetMapping("/preview/{file_key}")
    @PostMapping("/preview")
    @ApiOperation(value = "获取文件预览url(链接存在时效)")
    public Result getPreviewUrl(@PathVariable(value = "file_key") String fileKey) {
        return Result.ok().data(lmkFileService.getPreviewUrl(fileKey));
    public Result getPreviewUrl(@RequestBody FileKey fileKey) {
        return Result.ok().data(lmkFileService.getPreviewUrl(fileKey.getFileKey()));
    }