init
This commit is contained in:
@@ -137,6 +137,24 @@ public class OssClient {
|
||||
}
|
||||
}
|
||||
|
||||
public UploadResult uploadFile(byte[] data, String tenantPrefix, String suffix, String contentType) {
|
||||
return upload(data, getPath(properties.getPrefix(),tenantPrefix, suffix), contentType);
|
||||
}
|
||||
|
||||
private String getPath(String prefix,String tenantPrefix, String suffix) {
|
||||
// 生成uuid
|
||||
String uuid = IdUtil.fastSimpleUUID();
|
||||
// 文件路径
|
||||
String path = DateUtils.datePath() + "/" + uuid;
|
||||
if(StringUtils.isNotBlank(tenantPrefix)){
|
||||
path = tenantPrefix + "/" + path;
|
||||
}
|
||||
if (StringUtils.isNotBlank(prefix)) {
|
||||
path = prefix + "/" + path;
|
||||
}
|
||||
return path + suffix;
|
||||
}
|
||||
|
||||
public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) {
|
||||
return upload(data, getPath(properties.getPrefix(), suffix), contentType);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user