张涛 1年前
父节点
当前提交
795d3aaf58
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8
    5
      src/main/java/com/lyg/tools/controller/UploadController.java

+ 8
- 5
src/main/java/com/lyg/tools/controller/UploadController.java 查看文件

34
      * @throws Exception
34
      * @throws Exception
35
      */
35
      */
36
     @PostMapping("/upload/cms")
36
     @PostMapping("/upload/cms")
37
-    public ResponseBean uploadAdmin(@RequestParam(value = "file") MultipartFile file) throws Exception {
37
+    public ResponseBean uploadAdmin(@RequestParam(value = "file") MultipartFile file,
38
+                                    @PathVariable(value = "appid") String appid
39
+    ) throws Exception {
38
         String fileType = getFileType(file);
40
         String fileType = getFileType(file);
39
 
41
 
40
         Map<String, Object> res = new HashMap<>();
42
         Map<String, Object> res = new HashMap<>();
41
         String fileName = file.getOriginalFilename();
43
         String fileName = file.getOriginalFilename();
42
-        String path = fileUtil.saveFile(file, "cms");
44
+        String path = fileUtil.saveFile(file, appid);
43
         res.put("attachUrl", path);
45
         res.put("attachUrl", path);
44
         res.put("attachName", fileName);
46
         res.put("attachName", fileName);
45
         res.put("fileType", fileType);
47
         res.put("fileType", fileType);
54
      * @throws Exception
56
      * @throws Exception
55
      */
57
      */
56
     @PostMapping("/upload/base64/{appid}")
58
     @PostMapping("/upload/base64/{appid}")
57
-    public ResponseBean uploadBase64(@PathVariable(value = "appid") String appid,
58
-                                     @RequestParam(value = "base64") String base64,
59
-                                     @RequestParam(value = "fileName", defaultValue = "unknown.jpg") String fileName
59
+    public ResponseBean uploadBase64(
60
+            @PathVariable(value = "appid") String appid,
61
+            @RequestParam(value = "base64") String base64,
62
+            @RequestParam(value = "fileName", defaultValue = "unknown.jpg") String fileName
60
     ) throws Exception {
63
     ) throws Exception {
61
 
64
 
62
         Map<String, Object> res = new HashMap<>();
65
         Map<String, Object> res = new HashMap<>();