排位1.1
This commit is contained in:
parent
089cd1e0b8
commit
ef81341586
@ -16,7 +16,7 @@ class Season(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
['!info', [_common.Season()], '赛季信息'],
|
['info', _common.Season(), '赛季信息'],
|
||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'getRankingInfo',
|
'name': 'getRankingInfo',
|
||||||
@ -25,7 +25,6 @@ class Season(object):
|
|||||||
'url': 'webapp/index.php?c=Season&a=getRankingInfo',
|
'url': 'webapp/index.php?c=Season&a=getRankingInfo',
|
||||||
'params': [
|
'params': [
|
||||||
_common.ReqHead(),
|
_common.ReqHead(),
|
||||||
['rank',0,'段位id']
|
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
@ -34,7 +33,7 @@ class Season(object):
|
|||||||
]
|
]
|
||||||
},{
|
},{
|
||||||
'name': 'getDataInfo',
|
'name': 'getDataInfo',
|
||||||
'desc': '获取赛季基本信息',
|
'desc': '获取赛季战斗信息',
|
||||||
'group': 'Season',
|
'group': 'Season',
|
||||||
'url': 'webapp/index.php?c=Season&a=getDataInfo',
|
'url': 'webapp/index.php?c=Season&a=getDataInfo',
|
||||||
'params': [
|
'params': [
|
||||||
@ -42,8 +41,29 @@ class Season(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_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();
|
$nextRankMeta = mt\Rank::getMaxRank();
|
||||||
}
|
}
|
||||||
|
|
||||||
$seasonRankingDb = SeasonRanking::getSeasonList();
|
|
||||||
$totalPoint = 0;
|
$totalPoint = 0;
|
||||||
if ($seasonRankingDb){
|
SeasonRanking::getSeasonList(function ($row) use (&$totalPoint){
|
||||||
foreach ($seasonRankingDb as $item ){
|
$totalPoint += $row['ranking_point'] ;
|
||||||
$totalPoint += $item['ranking_point'] ;
|
});
|
||||||
}
|
|
||||||
}
|
|
||||||
$info = array(
|
$info = array(
|
||||||
'season' => $this->currRankSeasonMeta['id'],
|
'season' => $this->currRankSeasonMeta['id'],
|
||||||
'season_name' => $this->currRankSeasonMeta['name'],
|
'season_name' => $this->currRankSeasonMeta['name'],
|
||||||
@ -151,6 +149,20 @@ class SeasonController extends BaseAuthedController {
|
|||||||
$this->_rspData(['info'=>$currRankSeasonHistory]);
|
$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){
|
private function _getRewardByRanking($user){
|
||||||
if (!$user){
|
if (!$user){
|
||||||
return ;
|
return ;
|
||||||
|
@ -18,18 +18,16 @@ class SeasonRanking extends BaseModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getSeasonList(){
|
public static function getSeasonList($cb){
|
||||||
$rows = SqlHelper::ormSelect(
|
SqlHelper::ormSelect(
|
||||||
myself()->_getSelfMysql(),
|
myself()->_getSelfMysql(),
|
||||||
't_season_ranking',
|
't_season_ranking',
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'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){
|
if ($meta[$i]['id'] == 1){
|
||||||
$newScore = max($newScore,$meta[$i]['rank_score']);
|
$newScore = max($newScore,$meta[$i]['rank_score']);
|
||||||
}
|
}
|
||||||
if ($meta[$i]['id'] == count($meta)){
|
// if ($meta[$i]['id'] == count($meta)){
|
||||||
$newScore = min($newScore,$meta[$i]['rank_score']);
|
// $newScore = min($newScore,$meta[$i]['rank_score']);
|
||||||
}
|
// }
|
||||||
if ($i+1<=count($meta)){
|
if ($i+1<=count($meta)){
|
||||||
if($newScore>=$meta[$i]['rank_score'] && $newScore<$meta[$i+1]['rank_score']){
|
if($newScore>=$meta[$i]['rank_score'] && $newScore<$meta[$i+1]['rank_score']){
|
||||||
$newRank = $meta[$i]['id'];
|
$newRank = $meta[$i]['id'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user