排位1.1
This commit is contained in:
parent
089cd1e0b8
commit
ef81341586
@ -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积分'],
|
||||
]
|
@ -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 ;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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'];
|
||||
|
Loading…
x
Reference in New Issue
Block a user