|
|
@@ -12,15 +12,17 @@ import com.zhongshu.card.server.core.model.upLoadFile.StsToken;
|
|
|
import com.zhongshu.card.server.core.service.oss.NetDiskOssBusService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
+import jakarta.servlet.http.HttpServletRequest;
|
|
|
+import jakarta.servlet.http.HttpServletResponse;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestMethod;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -36,6 +38,16 @@ public class OssController {
|
|
|
@Autowired
|
|
|
NetDiskOssBusService netDiskOssService;
|
|
|
|
|
|
+ @ResourceAuth(value = "user", type = AuthType.User)
|
|
|
+ @RequestMapping(value = "uploadFile", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, method = RequestMethod.POST)
|
|
|
+ @Operation(summary = "网盘直接上传文件", description = "网盘直接上传文件")
|
|
|
+ public ResultContent<String> uploadFile(HttpServletRequest request, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws IOException {
|
|
|
+ if (file == null || file.isEmpty()) {
|
|
|
+ return ResultContent.buildFail("文件不能为空");
|
|
|
+ }
|
|
|
+ return netDiskOssService.uploadMinioFile(file);
|
|
|
+ }
|
|
|
+
|
|
|
@ResourceAuth(value = "user", type = AuthType.User)
|
|
|
@Operation(summary = "得到上传文件Token", description = "得到上传文件Token")
|
|
|
@RequestMapping(value = "getUploadToken", method = {RequestMethod.POST})
|