mirror of
https://gitee.com/log4j/pig.git
synced 2025-01-03 23:42:22 +08:00
commit
56b7cde2d2
@ -115,4 +115,16 @@ public class FileController {
|
||||
IoUtil.copy(resource.getInputStream(), response.getOutputStream());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件外网的访问地址
|
||||
* @param bucket
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
@Inner(false)
|
||||
@GetMapping("/online/{bucket}/{fileName}")
|
||||
public R<String> onlineFile(@PathVariable String bucket, @PathVariable String fileName) {
|
||||
return R.ok(sysFileService.onlineFile(bucket, fileName));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -54,4 +54,11 @@ public interface SysFileService extends IService<SysFile> {
|
||||
*/
|
||||
Boolean deleteFile(Long id);
|
||||
|
||||
/**
|
||||
* 获取外网访问地址
|
||||
* @param bucket
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
String onlineFile(String bucket, String fileName);
|
||||
}
|
||||
|
@ -126,4 +126,15 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
||||
this.save(sysFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认获取文件的在线地址
|
||||
* @param bucket
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String onlineFile(String bucket, String fileName) {
|
||||
return ossTemplate.getObjectURL(bucket, fileName, Duration.of(7, ChronoUnit.DAYS));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user