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

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

29
 
29
 
30
     /**
30
     /**
31
      * 通用端上传文件
31
      * 通用端上传文件
32
-     *
32
+     * @param projectId 应用Id
33
      * @return
33
      * @return
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,
37
     public ResponseBean uploadAdmin(@RequestParam(value = "file") MultipartFile file,
38
-                                    @PathVariable(value = "appid") String appid
38
+                                    @PathVariable(value = "projectId") String projectId
39
     ) throws Exception {
39
     ) throws Exception {
40
         String fileType = getFileType(file);
40
         String fileType = getFileType(file);
41
 
41
 
42
         Map<String, Object> res = new HashMap<>();
42
         Map<String, Object> res = new HashMap<>();
43
         String fileName = file.getOriginalFilename();
43
         String fileName = file.getOriginalFilename();
44
-        String path = fileUtil.saveFile(file, appid);
44
+        String path = fileUtil.saveFile(file, projectId);
45
         res.put("attachUrl", path);
45
         res.put("attachUrl", path);
46
         res.put("attachName", fileName);
46
         res.put("attachName", fileName);
47
         res.put("fileType", fileType);
47
         res.put("fileType", fileType);
51
     /**
51
     /**
52
      * 通过 Base64 上传文件
52
      * 通过 Base64 上传文件
53
      *
53
      *
54
-     * @param appid 应用Id
54
+     * @param projectId 应用Id
55
      * @return
55
      * @return
56
      * @throws Exception
56
      * @throws Exception
57
      */
57
      */
58
     @PostMapping("/upload/base64/{appid}")
58
     @PostMapping("/upload/base64/{appid}")
59
     public ResponseBean uploadBase64(
59
     public ResponseBean uploadBase64(
60
-            @PathVariable(value = "appid") String appid,
60
+            @PathVariable(value = "appid") String projectId,
61
             @RequestParam(value = "base64") String base64,
61
             @RequestParam(value = "base64") String base64,
62
             @RequestParam(value = "fileName", defaultValue = "unknown.jpg") String fileName
62
             @RequestParam(value = "fileName", defaultValue = "unknown.jpg") String fileName
63
     ) throws Exception {
63
     ) throws Exception {
65
         Map<String, Object> res = new HashMap<>();
65
         Map<String, Object> res = new HashMap<>();
66
         byte[] bytes = StringUtil.base64ToBytes(base64);
66
         byte[] bytes = StringUtil.base64ToBytes(base64);
67
 
67
 
68
-        String path = fileUtil.saveFile(bytes, fileName, appid);
68
+        String path = fileUtil.saveFile(bytes, fileName, projectId);
69
         res.put("url", path);
69
         res.put("url", path);
70
 
70
 
71
         return ResponseBean.success(res);
71
         return ResponseBean.success(res);