game2006api/webapp/mt/SeasonPoint.php
aozhiwei 0f75774543 1
2021-11-22 17:59:30 +08:00

51 lines
1.1 KiB
PHP

<?php
namespace mt;
use phpcommon;
class SeasonPoint {
public static function get($id)
{
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
}
public static function getOldSeasonPoint($id)
{
$meta = self::get($id);
return array(
'id' => $meta['id'],
'min' => $meta['min_point'],
'max' => $meta['max_point'],
'des' => $meta['des'],
'topoint' => $meta['topoint'],
'is_protect' => $meta['is_protect'],
);
}
public static function calcTopoint($userInfo)
{
$integral = 0;
foreach (self::getMetaList() as $meta) {
if ($userInfo['integral'] <= $meta['max_point'] ||
$meta['max_point'] == -1) {
$integral = $meta['topoint'];
break;
}
}
return $integral;
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('seasomPoint@seasomPoint.php');
}
return self::$metaList;
}
protected static $metaList;
}