修改排位赛空档期

This commit is contained in:
hujiabin 2023-08-22 16:58:48 +08:00
parent 129d947477
commit 175e93d96b
2 changed files with 20 additions and 0 deletions

View File

@ -39,6 +39,9 @@ class SeasonController extends BaseAuthedController {
{
parent::_handlePre();
$this->currRankSeasonMeta = mt\RankSeason::getCurrentSeason();
if (!$this->currRankSeasonMeta) {
$this->currRankSeasonMeta = mt\RankSeason::getLastSeason();
}
if (!$this->currRankSeasonMeta) {
$this->_rspErr(10, 'server internal error');
die();

View File

@ -19,6 +19,23 @@ class RankSeason
return self::$metaList;
}
public static function getLastSeason()
{
$metaList = self::getMetaList();
$count = count($metaList);
foreach ($metaList as $key => $meta) {
if (myself()->_getNowTime() >= strtotime($metaList[$key]['end_time']) &&
myself()->_getNowTime() <= strtotime($metaList[$key+1]['start_time'])) {
return $meta;
}
if ($key == $count && myself()->_getNowTime() >= strtotime($meta['end_time'])) {
return $meta;
}
}
return array();
}
public static function getCurrentSeason()
{
foreach (self::getMetaList() as $meta) {