From e580e39d71c0cf7c1e5ffc7fac17d9012f6ba075 Mon Sep 17 00:00:00 2001 From: linfeng <2445465217@qq.com> Date: Thu, 19 Oct 2023 10:17:37 +0800 Subject: [PATCH] =?UTF-8?q?APP=E6=96=87=E4=BB=B6=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/app/controller/AppOssController.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/linfeng/modules/app/controller/AppOssController.java b/src/main/java/io/linfeng/modules/app/controller/AppOssController.java index c5c077c..9c25e1d 100644 --- a/src/main/java/io/linfeng/modules/app/controller/AppOssController.java +++ b/src/main/java/io/linfeng/modules/app/controller/AppOssController.java @@ -41,8 +41,11 @@ public class AppOssController { @Value("${oss.max-size}") private Long maxSize; + @Autowired + private SysOssService sysOssService; - @ApiOperation("上传文件") + + @ApiOperation("APP端文件上传") @PostMapping("/upload") public R upload(@RequestParam("Image") MultipartFile file) throws Exception { if (file.isEmpty()) { @@ -53,6 +56,12 @@ public class AppOssController { String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String url = OSSFactory.build().uploadSuffix(file.getBytes(), suffix); + //保存文件信息 + SysOssEntity ossEntity = new SysOssEntity(); + ossEntity.setUrl(url); + ossEntity.setCreateDate(new Date()); + sysOssService.save(ossEntity); + return R.ok().put("result", url); }