diff --git a/doc/Season.py b/doc/Season.py index 3477e88c..d264cd4f 100644 --- a/doc/Season.py +++ b/doc/Season.py @@ -16,7 +16,7 @@ class Season(object): ], 'response': [ _common.RspHead(), - ['!info', [_common.Season()], '赛季信息'], + ['info', _common.Season(), '赛季信息'], ] },{ 'name': 'getRankingInfo', @@ -25,7 +25,6 @@ class Season(object): 'url': 'webapp/index.php?c=Season&a=getRankingInfo', 'params': [ _common.ReqHead(), - ['rank',0,'段位id'] ], 'response': [ _common.RspHead(), @@ -34,7 +33,7 @@ class Season(object): ] },{ 'name': 'getDataInfo', - 'desc': '获取赛季基本信息', + 'desc': '获取赛季战斗信息', 'group': 'Season', 'url': 'webapp/index.php?c=Season&a=getDataInfo', 'params': [ @@ -42,8 +41,29 @@ class Season(object): ], 'response': [ _common.RspHead(), - ['info', _common.SeasonData(), '赛季基本信息'], + ['info', _common.SeasonData(), '赛季战斗信息'], + ] + },{ + 'name': 'getSeasonPoint', + 'desc': '获取所有赛季积分获取信息', + 'group': 'Season', + 'url': 'webapp/index.php?c=Season&a=getSeasonPoint', + 'params': [ + _common.ReqHead(), + ], + 'response': [ + _common.RspHead(), + ['!data', [_common.SeasonPoint()], '赛季积分信息'], ] }, ] + +class SeasonPoint(object): + + def __init__(self): + self.fields = [ + ['season', 0, '赛季'], + ['ranking', 0, '排名'], + ['ranking_point', 0, 'SV积分'], + ] \ No newline at end of file diff --git a/webapp/controller/SeasonController.class.php b/webapp/controller/SeasonController.class.php index 1fa042a7..54603c6c 100644 --- a/webapp/controller/SeasonController.class.php +++ b/webapp/controller/SeasonController.class.php @@ -66,13 +66,11 @@ class SeasonController extends BaseAuthedController { $nextRankMeta = mt\Rank::getMaxRank(); } - $seasonRankingDb = SeasonRanking::getSeasonList(); $totalPoint = 0; - if ($seasonRankingDb){ - foreach ($seasonRankingDb as $item ){ - $totalPoint += $item['ranking_point'] ; - } - } + SeasonRanking::getSeasonList(function ($row) use (&$totalPoint){ + $totalPoint += $row['ranking_point'] ; + }); + $info = array( 'season' => $this->currRankSeasonMeta['id'], 'season_name' => $this->currRankSeasonMeta['name'], @@ -151,6 +149,20 @@ class SeasonController extends BaseAuthedController { $this->_rspData(['info'=>$currRankSeasonHistory]); } + public function getSeasonPoint(){ + $list = array(); + SeasonRanking::getSeasonList(function ($row) use (&$list) { + array_push($list,array( + 'season' => $row['season'], + 'ranking' => $row['ranking'], + 'ranking_point' => $row['ranking_point'], + )); + }); + $this->_rspData(array( + 'data' => $list, + )); + } + private function _getRewardByRanking($user){ if (!$user){ return ; diff --git a/webapp/models/SeasonRanking.php b/webapp/models/SeasonRanking.php index 4c638fd8..2bbc5ee1 100644 --- a/webapp/models/SeasonRanking.php +++ b/webapp/models/SeasonRanking.php @@ -18,18 +18,16 @@ class SeasonRanking extends BaseModel ); } - public static function getSeasonList(){ - $rows = SqlHelper::ormSelect( + public static function getSeasonList($cb){ + SqlHelper::ormSelect( myself()->_getSelfMysql(), 't_season_ranking', array( 'account_id' => myself()->_getAccountId(), - ) + ), + function ($row) use($cb) { + $cb($row); + } ); - - if (count($rows) < 1){ - $rows = null; - } - return $rows; } } \ No newline at end of file diff --git a/webapp/mt/Rank.php b/webapp/mt/Rank.php index 9903f67f..cd5f52cb 100644 --- a/webapp/mt/Rank.php +++ b/webapp/mt/Rank.php @@ -42,9 +42,9 @@ class Rank { if ($meta[$i]['id'] == 1){ $newScore = max($newScore,$meta[$i]['rank_score']); } - if ($meta[$i]['id'] == count($meta)){ - $newScore = min($newScore,$meta[$i]['rank_score']); - } +// if ($meta[$i]['id'] == count($meta)){ +// $newScore = min($newScore,$meta[$i]['rank_score']); +// } if ($i+1<=count($meta)){ if($newScore>=$meta[$i]['rank_score'] && $newScore<$meta[$i+1]['rank_score']){ $newRank = $meta[$i]['id'];