添加获取排行榜活动开启接口

This commit is contained in:
aozhiwei 2022-05-30 15:11:38 +08:00
parent c358b5cee3
commit f69362599e
3 changed files with 31 additions and 0 deletions

View File

@ -20,6 +20,19 @@ class Ranking(object):
['ranking_list', _common.RankingList(), '排行榜数据']
]
},
{
'name': 'getOpenList',
'desc': '获取已开启的活动榜',
'group': 'Ranking',
'url': 'webapp/index.php?c=Ranking&a=getOpenList',
'params': [
_common.ReqHead(),
],
'response': [
_common.RspHead(),
['!list', [0], '1:生存榜 2:击杀榜 3:英雄升级 4:英雄升阶'],
]
},
{
'name': 'activityRankingList',
'desc': '获取内试活动排行榜',

View File

@ -74,6 +74,13 @@ class RankingController extends BaseAuthedController {
));
}
public function getOpenList()
{
$this->_rspData(array(
'list' => mt\RankActivity::getOpenList()
));
}
public function activityRankingList()
{
$rankingData = $this->internalGetActivityRankData(getReqVal('type', 0));

View File

@ -11,6 +11,17 @@ class RankActivity {
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
}
public static function getOpenList()
{
$list = array();
foreach (self::getMetaList() as $meta) {
if ($meta['opentime'] <= myself()->_getNowTime()) {
array_push($list, $meta['id']);
}
}
return $list;
}
public static function isActivityPeriod($meta)
{
return myself()->_getNowTime() >= $meta['opentime'] &&