|
|
|
@ -144,52 +144,29 @@ class HeroUnion {
@@ -144,52 +144,29 @@ class HeroUnion {
|
|
|
|
|
getWaitingTask(platform, country, lang, data_mode) { |
|
|
|
|
let searchResult = null; |
|
|
|
|
|
|
|
|
|
for (const task of this.tasks) { |
|
|
|
|
if (searchResult) {break;} |
|
|
|
|
|
|
|
|
|
if (task.status == 'waiting') { |
|
|
|
|
if (typeof(platform) != 'undefined' && platform) { |
|
|
|
|
if (platform == task.platform) { |
|
|
|
|
searchResult = task; |
|
|
|
|
}else { |
|
|
|
|
searchResult = null; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof(country) != 'undefined' && country) { |
|
|
|
|
if (country == task.country) { |
|
|
|
|
searchResult = task; |
|
|
|
|
}else { |
|
|
|
|
searchResult = null; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof(lang) != 'undefined' && lang) { |
|
|
|
|
if (lang == task.lang) { |
|
|
|
|
searchResult = task; |
|
|
|
|
}else { |
|
|
|
|
searchResult = null; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof(data_mode) != 'undefined' && data_mode) { |
|
|
|
|
if (data_mode == task.data_mode) { |
|
|
|
|
searchResult = task; |
|
|
|
|
}else { |
|
|
|
|
searchResult = null; |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
let taskIndex = this.tasks.findIndex(function(item) { |
|
|
|
|
if (typeof(platform) != 'undefined' && platform && item.platform != platform) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (searchResult) { |
|
|
|
|
let taskIndex = this.tasks.findIndex((item) => item.id == searchResult.id); |
|
|
|
|
if (typeof(country) != 'undefined' && country && item.country != country) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof(lang) != 'undefined' && lang && item.lang != lang) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (typeof(data_mode) != 'undefined' && data_mode && task.data_mode != data_mode) { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
if (taskIndex > -1) { |
|
|
|
|
this.tasks[taskIndex].status = 'running'; |
|
|
|
|
searchResult.status = 'running'; |
|
|
|
|
searchResult = this.tasks[taskIndex]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return searchResult; |
|
|
|
|