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); }