93 lines
2.6 KiB
PHP
93 lines
2.6 KiB
PHP
<?php
|
|
|
|
|
|
namespace mt;
|
|
|
|
use phpcommon;
|
|
class RankSeason
|
|
{
|
|
public static function get($id)
|
|
{
|
|
return getXVal(self::getMetaList(), $id);
|
|
}
|
|
|
|
protected static function getMetaList()
|
|
{
|
|
if (!self::$metaList) {
|
|
self::$metaList = getMetaTable('rankSeason@rankSeason.php');
|
|
}
|
|
return self::$metaList;
|
|
}
|
|
|
|
public static function getLastSeason()
|
|
{
|
|
// $metaList = self::getMetaList();
|
|
// $count = count($metaList);
|
|
// foreach ($metaList as $key => $meta) {
|
|
// if ($key == $count && myself()->_getNowTime() >= strtotime($meta['end_time'])) {
|
|
// return $meta;
|
|
// }elseif (myself()->_getNowTime() >= strtotime($metaList[$key]['end_time']) &&
|
|
// myself()->_getNowTime() <= strtotime($metaList[$key+1]['start_time'])) {
|
|
// return $meta;
|
|
// }
|
|
// }
|
|
// return array();
|
|
|
|
$lastSeason = array();
|
|
foreach (self::getMetaList() as $meta){
|
|
if (myself()->_getNowTime() > strtotime($meta['end_time'])){
|
|
$lastSeason = $meta;
|
|
}
|
|
}
|
|
return $lastSeason;
|
|
}
|
|
|
|
public static function getCurrentSeason()
|
|
{
|
|
foreach (self::getMetaList() as $meta) {
|
|
if (myself()->_getNowTime() >= strtotime($meta['start_time']) &&
|
|
myself()->_getNowTime() <= strtotime($meta['end_time'])) {
|
|
return $meta;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public static function getNextCurrentSeason()
|
|
{
|
|
// $metaList = self::getMetaList();
|
|
// foreach ($metaList as $key => $meta) {
|
|
// if ($key == 1 && myself()->_getNowTime() <= strtotime($meta['start_time'])) {
|
|
// return $meta;
|
|
// }
|
|
// if ($key > 1 &&
|
|
// myself()->_getNowTime() >= strtotime($metaList[$key-1]['end_time']) &&
|
|
// myself()->_getNowTime() <= strtotime($metaList[$key]['start_time'])) {
|
|
// return $meta;
|
|
// }
|
|
// }
|
|
// return null;
|
|
$next = array();
|
|
foreach (self::getMetaList() as $meta){
|
|
if (myself()->_getNowTime() < strtotime($meta['start_time'])){
|
|
$next = $meta;
|
|
break;
|
|
}
|
|
}
|
|
return $next;
|
|
}
|
|
|
|
public static function getSeasonByTime($time)
|
|
{
|
|
foreach (self::getMetaList() as $meta) {
|
|
if ($time >= strtotime($meta['start_time']) &&
|
|
$time <= strtotime($meta['end_time'])) {
|
|
return $meta;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
protected static $metaList;
|
|
}
|