Преглед на файлове

修改文件上传逻辑

tianboguang преди 2 години
родител
ревизия
3e595d11e1
променени са 1 файла, в които са добавени 6 реда и са изтрити 3 реда
  1. 6 3
      src/main/java/com/fdkankan/contro/controller/SceneFileController.java

+ 6 - 3
src/main/java/com/fdkankan/contro/controller/SceneFileController.java

@@ -1,5 +1,8 @@
 package com.fdkankan.contro.controller;
 
+import com.fdkankan.common.constant.ErrorCode;
+import com.fdkankan.common.constant.ServerCode;
+import com.fdkankan.common.exception.BusinessException;
 import com.fdkankan.contro.common.Result;
 import com.fdkankan.contro.service.ISceneFileBuildService;
 import com.fdkankan.contro.vo.ResponseSceneFile;
@@ -72,12 +75,12 @@ public class SceneFileController{
      * @return
      */
     @RequestMapping(value = "upload", method = RequestMethod.POST)
-    public Result uploadFile(String key, @RequestParam("file") MultipartFile file) throws Exception {
+    public ResultData uploadFile(String key, @RequestParam("file") MultipartFile file) throws Exception {
         if(ObjectUtils.isEmpty(key) || ObjectUtils.isEmpty(file)){
             log.error("参数有误!");
-            return Result.failure("参数有误!");
+            throw new BusinessException(ErrorCode.PARAM_REQUIRED);
         }
         fYunFileService.uploadFile(file.getInputStream(),key.concat(File.separator).concat(file.getOriginalFilename()));
-        return Result.success();
+        return ResultData.ok();
     }
 }