|
@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
13
|
13
|
import org.springframework.web.bind.annotation.RestController;
|
14
|
14
|
import org.springframework.web.multipart.MultipartFile;
|
15
|
15
|
|
|
16
|
+import java.util.ArrayList;
|
|
17
|
+import java.util.List;
|
16
|
18
|
import java.util.Map;
|
17
|
19
|
|
18
|
20
|
/**
|
|
@@ -32,12 +34,14 @@ public class ImageController {
|
32
|
34
|
|
33
|
35
|
@ApiOperation(value = "图片上传以及获取url", notes = "图片上传以及获取url")
|
34
|
36
|
@PostMapping(value = "/uploadimage", consumes = "multipart/*", headers = "content-type=multipart/form-data")
|
35
|
|
- public ResponseBean uploadImgAndGetUrl(@ApiParam(value = "file" ,required = true) MultipartFile uploadFile) throws Exception {
|
|
37
|
+ public ResponseBean uploadImgAndGetUrl(@ApiParam(value = "uploadFiles" ,required = true) MultipartFile[] uploadFiles) throws Exception {
|
36
|
38
|
ResponseBean responseBean = new ResponseBean();
|
37
|
|
- Map<String,Object> map = Maps.newHashMap();
|
38
|
|
- String url = imageService.getImageUrl(uploadFile);
|
39
|
|
- map.put("url",url);
|
40
|
|
- responseBean.addSuccess(map);
|
|
39
|
+ List<String> urls = new ArrayList<String>();
|
|
40
|
+ for (MultipartFile uploadFile : uploadFiles){
|
|
41
|
+ String url = imageService.getImageUrl(uploadFile);
|
|
42
|
+ urls.add(url);
|
|
43
|
+ }
|
|
44
|
+ responseBean.addSuccess(urls);
|
41
|
45
|
return responseBean;
|
42
|
46
|
}
|
43
|
47
|
}
|