From f69362599e1ba185a753ae2274e0ed156a54edcf Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 30 May 2022 15:11:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E8=8E=B7=E5=8F=96=E6=8E=92?= =?UTF-8?q?=E8=A1=8C=E6=A6=9C=E6=B4=BB=E5=8A=A8=E5=BC=80=E5=90=AF=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/Ranking.py | 13 +++++++++++++ webapp/controller/RankingController.class.php | 7 +++++++ webapp/mt/RankActivity.php | 11 +++++++++++ 3 files changed, 31 insertions(+) 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'] &&