| | |
| | | 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; |
| | |
| | | * @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()); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @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())); |
| | | } |
| | | |
| | | |