|
|
|
@ -9,6 +9,7 @@ import (
|
|
|
|
|
// DownloadListResponse 下载列表响应条目
|
|
|
|
|
type DownloadListResponse struct {
|
|
|
|
|
UpdateTime int64 `json:"update"`
|
|
|
|
|
UpdateInterval int `json:"interval"`
|
|
|
|
|
Name string `json:"name"`
|
|
|
|
|
Status int `json:"status"`
|
|
|
|
|
UserID uint `json:"uid"`
|
|
|
|
@ -23,6 +24,7 @@ type DownloadListResponse struct {
|
|
|
|
|
// BuildDownloadingResponse 构建正在下载的列表响应
|
|
|
|
|
func BuildDownloadingResponse(tasks []model.Download) Response {
|
|
|
|
|
resp := make([]DownloadListResponse, 0, len(tasks))
|
|
|
|
|
interval := model.GetIntSetting("aria2_interval", 10)
|
|
|
|
|
|
|
|
|
|
for i := 0; i < len(tasks); i++ {
|
|
|
|
|
fileName := ""
|
|
|
|
@ -38,6 +40,7 @@ func BuildDownloadingResponse(tasks []model.Download) Response {
|
|
|
|
|
|
|
|
|
|
resp = append(resp, DownloadListResponse{
|
|
|
|
|
UpdateTime: tasks[i].UpdatedAt.Unix(),
|
|
|
|
|
UpdateInterval: interval,
|
|
|
|
|
Name: fileName,
|
|
|
|
|
Status: tasks[i].Status,
|
|
|
|
|
UserID: tasks[i].UserID,
|
|
|
|
|