热点资源

This commit is contained in:
limqhz
2022-05-03 17:45:15 +08:00
parent f271221d8b
commit 0eed40c97e
7 changed files with 39 additions and 14 deletions

View File

@@ -17,6 +17,6 @@ import java.io.OutputStream;
*/
public interface SourceService extends IService<Source> {
void downloadSource(ServletOutputStream outputStream, String sid) throws IOException;
void downloadSource(ServletOutputStream outputStream, Source source) throws IOException;
}

View File

@@ -30,8 +30,7 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
OSSClientUtil ossClientUtil;
@Override
public void downloadSource(ServletOutputStream outputStream, String sid) throws IOException {
Source source = getOne(new QueryWrapper<Source>().eq("id", sid));
public void downloadSource(ServletOutputStream outputStream, Source source) throws IOException {
String sourceLink = source.getSourceLink();
// 读取文件内容。
BufferedInputStream in = new BufferedInputStream(ossClientUtil.downloadFile(sourceLink));