From df878618a8882fc057a5863738df43e1fcd878ea Mon Sep 17 00:00:00 2001
From: zengh <123456>
Date: Wed, 14 Sep 2022 08:48:06 +0800
Subject: [PATCH] 密码修改
---
src/main/java/org/springblade/modules/depl/controller/DeplController.java | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 48 insertions(+), 6 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 8a31c01..6d62eb0 100644
--- a/src/main/java/org/springblade/modules/depl/controller/DeplController.java
+++ b/src/main/java/org/springblade/modules/depl/controller/DeplController.java
@@ -36,6 +36,7 @@
import org.springframework.web.multipart.MultipartFile;
import org.xmlpull.v1.XmlPullParserException;
+import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.io.InputStream;
@@ -139,13 +140,54 @@
*
* @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(@RequestParam MultipartFile file) throws IOException, ServerException, InsufficientDataException, InternalException, InvalidResponseException, InvalidKeyException, NoSuchAlgorithmException, XmlParserException, ErrorResponseException {
+ 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://web.byisf.com:9000";
- String access = "adminminio";
- String secret = "adminminio";
- String bucket = "jfpt";
+ String url = "http://106.225.193.35:2081";
+ String access = "zhbaadmin";
+ String secret = "zhbapassword";
+ String bucket = "hcyj";
MinioClient minioClient =
MinioClient.builder()
.endpoint(url)
@@ -173,7 +215,7 @@
.headers(headers)
.build());
in.close();
- String urls = "https://web.byisf.com/minio/jfpt/" + newName;
+ String urls = "http://106.225.193.35:2081/hcyj/" + newName;
return R.data(urls);
}
--
Gitblit v1.9.3