1
This commit is contained in:
parent
79aae72bf9
commit
e49923b9b7
@ -40,28 +40,33 @@ class OutAppCircuitController extends BaseController {
|
|||||||
if (SERVER_ENV != _ONLINE) {
|
if (SERVER_ENV != _ONLINE) {
|
||||||
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
||||||
}
|
}
|
||||||
if (!$user){
|
|
||||||
myself()->_rspErr(1, 'user not found');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$redis = $this->_getRedis($this->redis_key_circuit_ranking);
|
|
||||||
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking)){
|
|
||||||
$rows = Circuit::getCircuitList($currentCircuitMeta['circuit_season']);
|
|
||||||
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
|
|
||||||
$list = $this->_extractRankingInfo($sortRows);
|
|
||||||
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , json_encode($list));
|
|
||||||
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , 10*60*1000);
|
|
||||||
}else{
|
|
||||||
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking);
|
|
||||||
$list = emptyReplace(json_decode($listStr, true), array());
|
|
||||||
}
|
|
||||||
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
|
|
||||||
$info = array(
|
$info = array(
|
||||||
'star_time' => strtotime($currentCircuitMeta['start_time']),
|
'star_time' => strtotime($currentCircuitMeta['start_time']),
|
||||||
'end_time' => strtotime($currentCircuitMeta['end_time']),
|
'end_time' => strtotime($currentCircuitMeta['end_time']),
|
||||||
'ranking' => $myInfo['ranking'],
|
'ranking' => 0,
|
||||||
'score' => $myInfo['score'],
|
'score' => 0,
|
||||||
);
|
);
|
||||||
|
if (!$user){
|
||||||
|
} else {
|
||||||
|
$redis = $this->_getRedis($this->redis_key_circuit_ranking);
|
||||||
|
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking)){
|
||||||
|
$rows = Circuit::getCircuitList($currentCircuitMeta['circuit_season']);
|
||||||
|
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
|
||||||
|
$list = $this->_extractRankingInfo($sortRows);
|
||||||
|
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , json_encode($list));
|
||||||
|
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking , 10*60*1000);
|
||||||
|
}else{
|
||||||
|
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_ranking);
|
||||||
|
$list = emptyReplace(json_decode($listStr, true), array());
|
||||||
|
}
|
||||||
|
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
|
||||||
|
$info = array(
|
||||||
|
'star_time' => strtotime($currentCircuitMeta['start_time']),
|
||||||
|
'end_time' => strtotime($currentCircuitMeta['end_time']),
|
||||||
|
'ranking' => $myInfo['ranking'],
|
||||||
|
'score' => $myInfo['score'],
|
||||||
|
);
|
||||||
|
}
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'rank_list' => $list,
|
'rank_list' => $list,
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
@ -86,31 +91,36 @@ class OutAppCircuitController extends BaseController {
|
|||||||
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
$user = User::find('2_2006_I75DCdyQRllgGRYvT0wcGtPR9gbDUZws');
|
||||||
}
|
}
|
||||||
if (!$user){
|
if (!$user){
|
||||||
myself()->_rspErr(1, 'user not found');
|
$info = array(
|
||||||
return;
|
'star_time' => strtotime($currentStageMeta['start_time']),
|
||||||
|
'end_time' => strtotime($currentStageMeta['end_time']),
|
||||||
|
'ranking' => 0,
|
||||||
|
'score' => 0
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
$currentStageMeta = mt\CircuitTime::getCurrentStage();
|
||||||
|
if (!$currentStageMeta){
|
||||||
|
$currentStageMeta = mt\CircuitTime::getPrevStage();
|
||||||
|
}
|
||||||
|
$redis = $this->_getRedis($this->redis_key_circuit_phase_ranking);
|
||||||
|
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking)){
|
||||||
|
$rows = Circuit::getCircuitPhaseList($currentStageMeta['circuit_season'],$currentStageMeta['circuit_phase']);
|
||||||
|
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
|
||||||
|
$list = $this->_extractRankingInfo($sortRows);
|
||||||
|
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , json_encode($list));
|
||||||
|
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , 10*60*1000);
|
||||||
|
}else{
|
||||||
|
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking);
|
||||||
|
$list = emptyReplace(json_decode($listStr, true), array());
|
||||||
|
}
|
||||||
|
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
|
||||||
|
$info = array(
|
||||||
|
'star_time' => strtotime($currentStageMeta['start_time']),
|
||||||
|
'end_time' => strtotime($currentStageMeta['end_time']),
|
||||||
|
'ranking' => $myInfo['ranking'],
|
||||||
|
'score' => $myInfo['score'],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$currentStageMeta = mt\CircuitTime::getCurrentStage();
|
|
||||||
if (!$currentStageMeta){
|
|
||||||
$currentStageMeta = mt\CircuitTime::getPrevStage();
|
|
||||||
}
|
|
||||||
$redis = $this->_getRedis($this->redis_key_circuit_phase_ranking);
|
|
||||||
if (! $redis->exists(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking)){
|
|
||||||
$rows = Circuit::getCircuitPhaseList($currentStageMeta['circuit_season'],$currentStageMeta['circuit_phase']);
|
|
||||||
$sortRows = myself()->arraySort($rows, 'cumulative_score', 'desc');
|
|
||||||
$list = $this->_extractRankingInfo($sortRows);
|
|
||||||
$redis->set(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , json_encode($list));
|
|
||||||
$redis->pexpire(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking , 10*60*1000);
|
|
||||||
}else{
|
|
||||||
$listStr = $redis->get(CIRCUIT_RANKING_KEY.$this->redis_key_circuit_phase_ranking);
|
|
||||||
$list = emptyReplace(json_decode($listStr, true), array());
|
|
||||||
}
|
|
||||||
$myInfo = $this->_celMyRankingInfo($list,$user['account_id']);
|
|
||||||
$info = array(
|
|
||||||
'star_time' => strtotime($currentStageMeta['start_time']),
|
|
||||||
'end_time' => strtotime($currentStageMeta['end_time']),
|
|
||||||
'ranking' => $myInfo['ranking'],
|
|
||||||
'score' => $myInfo['score'],
|
|
||||||
);
|
|
||||||
$this->_rspData(array(
|
$this->_rspData(array(
|
||||||
'rank_list' => $list,
|
'rank_list' => $list,
|
||||||
'info' => $info,
|
'info' => $info,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user