From 9af76a989343d4cfbb5e900c97e7e440d6597647 Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Thu, 26 Aug 2021 17:24:16 +0800
Subject: [PATCH] 新闻修改
---
src/main/java/org/springblade/modules/depl/controller/DeplController.java | 94 +++++++++++++++++++++++-----------------------
1 files changed, 47 insertions(+), 47 deletions(-)
diff --git a/src/main/java/org/springblade/modules/depl/controller/DeplController.java b/src/main/java/org/springblade/modules/depl/controller/DeplController.java
index c712368..9271cfd 100644
--- a/src/main/java/org/springblade/modules/depl/controller/DeplController.java
+++ b/src/main/java/org/springblade/modules/depl/controller/DeplController.java
@@ -140,54 +140,13 @@
*
* @param file
*/
- @PostMapping("put-depl")
- public R put(@RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
- //填写你文件上传的地址以及相应信息
- String url = "http://web.byisf.com:9000";
- String access = "adminminio";
- String secret = "adminminio";
- String bucket = "jfpt";
- MinioClient minioClient =
- MinioClient.builder()
- .endpoint(url)
- .credentials(access, secret)
- .build();
- // 检查存储桶是否已经存在
- boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucket).build());
- if (!isExist) {
- // 创建一个名为zip的存储桶,用于zip文件。
- minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucket).build());
- minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
- }
- String fileName = file.getOriginalFilename();
- String newName = "upload/depl/" + UUID.randomUUID().toString().replaceAll("-", "")
- + fileName.substring(fileName.lastIndexOf("."));
- InputStream in = file.getInputStream();
- //创建头部信息
- Map<String, String> headers = new HashMap<>(1 << 2);
- //添加自定义内容类型
- headers.put("Content-Type", "application/octet-stream");
- //上传
- minioClient.putObject(
- PutObjectArgs.builder().bucket(bucket).object(newName).stream(
- in, in.available(), -1)
- .headers(headers)
- .build());
- in.close();
- String urls = "https://web.byisf.com/minio/jfpt/" + newName;
- return R.data(urls);
- }
-
// @PostMapping("put-depl")
-// public R put(HttpServletResponse response, @RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
-// response.setHeader("Access-Control-Allow-Origin", "*");
-// response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
-// response.setHeader("Access-Control-Allow-Credentials","true");
+// public R put(@RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
// //填写你文件上传的地址以及相应信息
-// String url = "http://223.82.109.183:2081";
-// String access = "zhbaadmin";
-// String secret = "zhbapassword";
-// String bucket = "zhba";
+// String url = "http://web.byisf.com:9000";
+// String access = "adminminio";
+// String secret = "adminminio";
+// String bucket = "jfpt";
// MinioClient minioClient =
// MinioClient.builder()
// .endpoint(url)
@@ -215,10 +174,51 @@
// .headers(headers)
// .build());
// in.close();
-// String urls = "http://223.82.109.183:2081/minio/zhba/" + newName;
+// String urls = "https://web.byisf.com/minio/jfpt/" + newName;
// return R.data(urls);
// }
+ @PostMapping("put-depl")
+ public R put(HttpServletResponse response, @RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
+ response.setHeader("Access-Control-Allow-Origin", "*");
+ response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
+ response.setHeader("Access-Control-Allow-Credentials","true");
+ //填写你文件上传的地址以及相应信息
+ String url = "http://223.82.109.183:2081";
+ String access = "zhbaadmin";
+ String secret = "zhbapassword";
+ String bucket = "zhba";
+ MinioClient minioClient =
+ MinioClient.builder()
+ .endpoint(url)
+ .credentials(access, secret)
+ .build();
+ // 检查存储桶是否已经存在
+ boolean isExist = minioClient.bucketExists(BucketExistsArgs.builder().bucket(bucket).build());
+ if (!isExist) {
+ // 创建一个名为zip的存储桶,用于zip文件。
+ minioClient.makeBucket(MakeBucketArgs.builder().bucket(bucket).build());
+ minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucket).build());
+ }
+ String fileName = file.getOriginalFilename();
+ String newName = "upload/depl/" + UUID.randomUUID().toString().replaceAll("-", "")
+ + fileName.substring(fileName.lastIndexOf("."));
+ InputStream in = file.getInputStream();
+ //创建头部信息
+ Map<String, String> headers = new HashMap<>(1 << 2);
+ //添加自定义内容类型
+ headers.put("Content-Type", "application/octet-stream");
+ //上传
+ minioClient.putObject(
+ PutObjectArgs.builder().bucket(bucket).object(newName).stream(
+ in, in.available(), -1)
+ .headers(headers)
+ .build());
+ in.close();
+ String urls = "http://223.82.109.183:2081/zhba/" + newName;
+ return R.data(urls);
+ }
+
/**
* 部署详情
*/
--
Gitblit v1.9.3