2
0

fix: kyc return relative directory

This commit is contained in:
zhangsz
2025-01-17 17:08:01 +08:00
parent 7df3b8d643
commit bbb9542433
3 changed files with 24 additions and 26 deletions

View File

@@ -33,12 +33,12 @@ public class SysFileController {
// 上传并返回访问地址
FileUploadResult urlResult = sysFileService.uploadFile(file);
SysFile sysFile = new SysFile();
sysFile.setName(FileUtils.getName(urlResult.getUri()));
sysFile.setName(FileUtils.getName(urlResult.getUrl()));
sysFile.setName(FileUtils.getName(urlResult.getLocalUrl()));
sysFile.setName(FileUtils.getName(urlResult.getGatewayUrl()));
sysFile.setUri(urlResult.getUri());
sysFile.setUrl(urlResult.getUrl());
sysFile.setLocalUrl(urlResult.getLocalUrl());
sysFile.setUrl(urlResult.getGatewayUrl());
sysFile.setGatewayUrl(urlResult.getGatewayUrl());
return R.ok(sysFile);
} catch (Exception e) {
log.error("上传文件失败", e);

View File

@@ -49,25 +49,25 @@ public class LocalSysFileServiceImpl implements ISysFileService
@Override
public FileUploadResult uploadFile(MultipartFile file) throws Exception {
String name = FileUploadUtils.upload(localFilePath, file);
String uri = localFilePrefix + name;
String url = localFilePrefix + name;
String localUrl = domain + localFilePrefix + name;
String gatewayUrl = gateway + pathPrefix + localFilePrefix + name;
return new FileUploadResult(uri, localUrl, gatewayUrl);
return new FileUploadResult(url, localUrl, gatewayUrl);
}
public static class FileUploadResult {
private final String uri;
private final String url;
private final String localUrl;
private final String gatewayUrl;
public FileUploadResult(String uri, String localUrl, String gatewayUrl) {
this.uri = uri;
public FileUploadResult(String url, String localUrl, String gatewayUrl) {
this.url = url;
this.localUrl = localUrl;
this.gatewayUrl = gatewayUrl;
}
public String getUri() {
return uri;
public String getUrl() {
return url;
}
public String getLocalUrl() {