This commit is contained in:
N1KO 2024-12-16 17:06:07 +08:00
parent b5bd70e0df
commit 167e16fb0b

View File

@ -118,13 +118,18 @@ public abstract class AbstractMusicService<Q extends AbstractMusicReq, S extends
if (CollectionUtils.isEmpty(idList)) { if (CollectionUtils.isEmpty(idList)) {
throw new BusinessException("请选择下载内容"); throw new BusinessException("请选择下载内容");
} }
if (!ADMIN_ID_LIST.contains(userId) && idList.size() > 100) { if (!ADMIN_ID_LIST.contains(userId) && idList.size() > 10) {
throw new BusinessException("单次下载限制最多100"); throw new BusinessException("单次下载限制最多10");
} }
ChannelEnum channelEnum = getChannelEnum(); ChannelEnum channelEnum = getChannelEnum();
ChannelClient<Q, S> channelClient = channelClientFactory.getClient(channelEnum); ChannelClient<Q, S> channelClient = channelClientFactory.getClient(channelEnum);
String batchNo = UUID.randomUUID().toString(); String batchNo = UUID.randomUUID().toString();
idList.forEach(id -> { idList.parallelStream().forEach(id -> {
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
log.error(">>>>>>>>>>download error:{}<<<<<<<<<<", e.getMessage(), e);
}
MusicRecordEntity entity = channelClient.queryByPlatform(id); MusicRecordEntity entity = channelClient.queryByPlatform(id);
if (Objects.nonNull(entity)) { if (Objects.nonNull(entity)) {
channelClient.saveDownloadRecord(userId, batchNo, id); channelClient.saveDownloadRecord(userId, batchNo, id);