mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-20 18:15:56 +08:00
add 新增了oss指定文件夹上传
This commit is contained in:
parent
d1681dc18c
commit
7f4df15c34
@ -118,6 +118,10 @@ public class OssClient {
|
|||||||
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public UploadResult uploadByFolder(byte[] data, String suffix, String contentType,String folder) {
|
||||||
|
return upload(data, getFolderPath(properties.getPrefix(),folder, suffix), contentType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件元数据
|
* 获取文件元数据
|
||||||
*
|
*
|
||||||
@ -157,6 +161,24 @@ public class OssClient {
|
|||||||
return path + suffix;
|
return path + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFolderPath(String prefix, String folder, String suffix) {
|
||||||
|
// 生成uuid
|
||||||
|
String uuid = IdUtil.fastSimpleUUID();
|
||||||
|
// 文件路径
|
||||||
|
String path = DateUtils.datePath() + "/" + uuid;
|
||||||
|
if(StringUtils.isNotBlank(prefix) && StringUtils.isNotBlank(folder)){
|
||||||
|
path = prefix + "/" + folder + "/" + path;
|
||||||
|
}else{
|
||||||
|
if(StringUtils.isNotBlank(prefix)){
|
||||||
|
path = folder + "/" + path;
|
||||||
|
}
|
||||||
|
if(StringUtils.isNotBlank(folder)){
|
||||||
|
path = prefix + "/" + path;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return path + suffix;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getConfigKey() {
|
public String getConfigKey() {
|
||||||
return configKey;
|
return configKey;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user