game2006api/webapp/mt/Dailyselection.php
songliang d80a45283f ...
2023-06-16 13:58:10 +08:00

50 lines
1.2 KiB
PHP

<?php
namespace mt;
use phpcommon;
class Dailyselection
{
public static function get($id)
{
return getXVal(self::getMetaList(), $id);
}
public static function getBySlot($slot)
{
self::cacheDailyselectionInSlot();
$dailyselection = getXVal(self::$cacheDailyselectionInSlotList, $slot, null);
return $dailyselection;
}
protected static function cacheDailyselectionInSlot()
{
if (!self::$cacheDailyselectionInSlotList) {
self::$cacheDailyselectionInSlotList = array();
foreach (self::getMetaList() as $meta) {
$keys = explode("|", $meta['slot']);
foreach ($keys as $key) {
if (!getXVal(self::$cacheDailyselectionInSlotList, $key, null)) {
self::$cacheDailyselectionInSlotList[$key] = array();
}
array_push(self::$cacheDailyselectionInSlotList[$key], $meta);
}
}
}
return self::$cacheDailyselectionInSlotList;
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('Dailyselection@Dailyselection.php');
}
return self::$metaList;
}
protected static $cacheDailyselectionInSlotList;
protected static $metaList;
}