diff --git a/doc/Ranking.py b/doc/Ranking.py index 90b2b759..0ab8c510 100644 --- a/doc/Ranking.py +++ b/doc/Ranking.py @@ -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': '获取内试活动排行榜', diff --git a/webapp/controller/RankingController.class.php b/webapp/controller/RankingController.class.php index ab2a1e7c..7fe31a1e 100644 --- a/webapp/controller/RankingController.class.php +++ b/webapp/controller/RankingController.class.php @@ -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)); diff --git a/webapp/mt/RankActivity.php b/webapp/mt/RankActivity.php index 64bc46c5..cbf3203c 100644 --- a/webapp/mt/RankActivity.php +++ b/webapp/mt/RankActivity.php @@ -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'] &&