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