更新依赖

This commit is contained in:
lyswhut
2020-11-10 10:59:45 +08:00
parent b820adf0bf
commit 4cdd2110a6
9 changed files with 71 additions and 57 deletions
+7 -5
View File
@@ -377,11 +377,13 @@ const actions = {
},
}
commit('setStatusText', { downloadInfo, text: '获取URL中...' })
let p = options.url ? Promise.resolve() : getUrl(downloadInfo).then(result => {
commit('updateUrl', { downloadInfo, url: result.url })
if (!result.url) return Promise.reject(new Error('获取URL失败'))
options.url = result.url
})
let p = options.url
? Promise.resolve()
: getUrl(downloadInfo).then(result => {
commit('updateUrl', { downloadInfo, url: result.url })
if (!result.url) return Promise.reject(new Error('获取URL失败'))
options.url = result.url
})
p.then(() => {
tryNum[downloadInfo.key] = 0
dls[downloadInfo.key] = download(options)
+6 -4
View File
@@ -85,10 +85,12 @@ const actions = {
let source = rootState.setting.songList.source
const loadData = (id, page) => {
let key = `sdetail__${source}__${id}__${page}`
return cache.has(key) ? Promise.resolve(cache.get(key)) : music[source].songList.getListDetail(id, page).then(result => {
cache.set(key, result)
return result
})
return cache.has(key)
? Promise.resolve(cache.get(key))
: music[source].songList.getListDetail(id, page).then(result => {
cache.set(key, result)
return result
})
}
return loadData(id, 1).then(result => {
if (result.total <= result.limit) return result.list