批量检测时未检查过的优先

This commit is contained in:
buvta
2020-11-07 10:29:22 +08:00
parent 25d65866ae
commit 1f25219cdc
2 changed files with 16 additions and 6 deletions

View File

@@ -433,7 +433,11 @@ export default {
},
async checkAllSite () {
this.checkAllSitesLoading = true
Promise.all(this.sites.map(site => this.checkSingleSite(site))).then(res => {
this.stopFlag = false
const uncheckedList = this.sites.filter(e => e.status === undefined || e.status === ' ') // 未检测过的优先
const other = this.sites.filter(e => !uncheckedList.includes(e))
await Promise.all(uncheckedList.map(site => this.checkSingleSite(site)))
await Promise.all(other.map(site => this.checkSingleSite(site))).then(res => {
this.checkAllSitesLoading = false
this.getSites()
})

View File

@@ -416,8 +416,17 @@ export default {
async checkAllChannels () {
this.checkAllChannelsLoading = true
this.stopFlag = false
const uncheckedList = this.iptvList.filter(e => e.status === undefined || e.status === ' ') // 未检测过的优先
const other = this.iptvList.filter(e => !uncheckedList.includes(e))
await this.checkChannelList(uncheckedList)
await this.checkChannelList(other).then(res => {
this.checkAllChannelsLoading = false
this.getChannels()
})
},
async checkChannelList (channelList) {
var siteList = {}
this.iptvList.forEach(channel => {
channelList.forEach(channel => {
const site = channel.url.split('/')[2]
if (siteList[site]) {
siteList[site].push(channel)
@@ -425,10 +434,7 @@ export default {
siteList[site] = [channel]
}
})
Promise.all(Object.values(siteList).map(site => this.checkSingleSite(site))).then(res => {
this.checkAllChannelsLoading = false
this.getChannels()
})
await Promise.all(Object.values(siteList).map(site => this.checkSingleSite(site)))
},
async checkSingleSite (channelArray) {
for (const c of channelArray) {