修改了七牛云对象存储的功能模块
This commit is contained in:
parent
411ac03e85
commit
cc83b99993
2
pom.xml
2
pom.xml
@ -225,7 +225,7 @@
|
||||
<dependency>
|
||||
<groupId>com.qiniu</groupId>
|
||||
<artifactId>qiniu-java-sdk</artifactId>
|
||||
<version>[7.2.0, 7.2.99]</version>
|
||||
<version>7.2.11</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
|
@ -43,6 +43,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET,"/api/user/verificationCode").permitAll()
|
||||
// 手机号登录
|
||||
.antMatchers(HttpMethod.POST,"/api/user/loginByPhone").permitAll()
|
||||
.antMatchers(HttpMethod.POST,"/qiNiuUploadFile").permitAll()
|
||||
// 所有其它请求需要身份认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
@ -27,11 +27,17 @@ public class UploadImageServiceImpl implements UploadImageService {
|
||||
|
||||
private QiNiuYunConfig qiNiuYunConfig;
|
||||
|
||||
// 七牛文件上传管理器
|
||||
/**
|
||||
* 七牛文件上传管理器
|
||||
*/
|
||||
private UploadManager uploadManager;
|
||||
//上传的token
|
||||
/**
|
||||
* 上传的token
|
||||
*/
|
||||
private String token;
|
||||
// 七牛认证管理
|
||||
/**
|
||||
* 管理
|
||||
*/
|
||||
private Auth auth;
|
||||
|
||||
private BucketManager bucketManager;
|
||||
@ -43,7 +49,7 @@ public class UploadImageServiceImpl implements UploadImageService {
|
||||
|
||||
private void init() {
|
||||
// 构造一个带指定Zone对象的配置类, 注意这里的Zone.zone0需要根据主机选择
|
||||
uploadManager = new UploadManager(new Configuration(Zone.zone2()));
|
||||
uploadManager = new UploadManager(new Configuration(Zone.zone1()));
|
||||
auth = Auth.create(qiNiuYunConfig.getAccessKey(), qiNiuYunConfig.getSecretKey());
|
||||
// 根据命名空间生成的上传token
|
||||
bucketManager = new BucketManager(auth, new Configuration(Zone.zone2()));
|
||||
@ -72,7 +78,6 @@ public class UploadImageServiceImpl implements UploadImageService {
|
||||
}
|
||||
// 解析上传成功的结果
|
||||
DefaultPutRet putRet = new Gson().fromJson(res.bodyString(), DefaultPutRet.class);
|
||||
|
||||
// 直接返回外链地址
|
||||
return getPrivateFile(imgName);
|
||||
}
|
||||
|
@ -90,13 +90,11 @@ my.LoginErrorIntervalTime = 60
|
||||
|
||||
|
||||
#公共密钥
|
||||
qiniu.accessKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
qiniu.accessKey=ff2M6nXkD7T7eneAa62eIT3hXHvF4_coarpwgL2F
|
||||
# 私钥
|
||||
qiniu.secretKey=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
qiniu.secretKey=Sk0bJQpQs1iTcqTqaCpypzTgep4g8U1nQbmZx-hh
|
||||
# 空间名
|
||||
qiniu.bucket=XXXXXXX
|
||||
|
||||
qiniu.zone=XXXXXXX
|
||||
qiniu.bucket=business-leyihang
|
||||
# 外链默认域名
|
||||
qiniu.domain=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
qiniu.domain=http://r4el6ttsm.hb-bkt.clouddn.com
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user