Fix: refresh interval not working

This commit is contained in:
HFO4
2021-11-30 19:26:35 +08:00
parent af4d9767c2
commit 84d81f201f
4 changed files with 20 additions and 5 deletions

View File

@@ -34,7 +34,16 @@ func (service *DownloadListService) Finished(c *gin.Context, user *model.User) s
func (service *DownloadListService) Downloading(c *gin.Context, user *model.User) serializer.Response {
// 查找下载记录
downloads := model.GetDownloadsByStatusAndUser(service.Page, user.ID, common.Downloading, common.Paused, common.Ready)
return serializer.BuildDownloadingResponse(downloads)
intervals := make(map[uint]int)
for _, download := range downloads {
if _, ok := intervals[download.ID]; !ok {
if node := cluster.Default.GetNodeByID(download.GetNodeID()); node != nil {
intervals[download.ID] = node.DBModel().Aria2OptionsSerialized.Interval
}
}
}
return serializer.BuildDownloadingResponse(downloads, intervals)
}
// Delete 取消或删除下载任务