| | |
| | | |
| | | import com.kidgrow.common.model.PageResult; |
| | | import com.kidgrow.common.model.Result; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.filecenter.model.FileInfo; |
| | | import com.kidgrow.filecenter.service.IFileService; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping("/files-anon") |
| | | @PostMapping(value="/files-anon",consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public FileInfo upload(@RequestParam("file") MultipartFile file) throws Exception { |
| | | return fileService.upload(file); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 文件上传 |
| | | * 根据fileType选择上传方式 |
| | | * |
| | | * @param file |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value="/files-upload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public FileInfo feignUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) throws Exception { |
| | | return fileService.upload(file,imgType); |
| | | } |
| | | /** |
| | | * 文件上传 返回带缩略图地址的对象,缩略图在path字段 |
| | | * |
| | | * @param file |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | @PostMapping(value="/files-thupload",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public FileInfo thUpload(@RequestPart("file") MultipartFile file,@RequestParam String imgType) throws Exception { |
| | | return fileService.uploadForThumbnails(file,imgType); |
| | | } |
| | | /** |
| | | * base64上传图片 |
| | | */ |
| | | @PostMapping(value="baseUplaod",produces = {MediaType.APPLICATION_JSON_UTF8_VALUE},consumes = MediaType.MULTIPART_FORM_DATA_VALUE) |
| | | public FileInfo baseUplaod(@RequestParam("file") String file,@RequestParam("imgType") String imgType){ |
| | | return fileService.baseUplaod(file,imgType); |
| | | } |
| | | /** |
| | | * base64图片下载 |
| | | */ |
| | | @PostMapping(value="baseDownLoad") |
| | | public ResultBody baseDownLoad(@RequestBody Map<String,Object> map) throws Exception{ |
| | | return fileService.baseDownLoad(map); |
| | | } |
| | | |
| | | /** |
| | | * 文件删除 |
| | | * |