This commit is contained in:
hujiabin 2023-03-27 16:51:53 +08:00
parent 9ac15bd37c
commit 56ff5f5856

View File

@ -775,17 +775,20 @@ class UserController extends BaseAuthedController {
if ($last_ranking_time && floor((myself()->_getNowTime()-$last_ranking_time)/86400) >= 7){ if ($last_ranking_time && floor((myself()->_getNowTime()-$last_ranking_time)/86400) >= 7){
$userDb = $this->_getOrmUserInfo(); $userDb = $this->_getOrmUserInfo();
$rank_key = mt\Rank::getRankById($userDb['rank'])?mt\Rank::getRankById($userDb['rank'])['rank_order2']:0; $rank_key = mt\Rank::getRankById($userDb['rank'])?mt\Rank::getRankById($userDb['rank'])['rank_order2']:0;
$paramMeta = mt\Parameter::getByName('rank_pass_point'); $paramMeta = mt\Parameter::getByName('rank_point_reduce');
if ($paramMeta){ if ($paramMeta){
$valArr = explode('|',$paramMeta['param_value']); $param_value = explode('|',$paramMeta['param_value']);
$deductScore = $valArr[$rank_key-1]; $deductScore = $param_value[$rank_key-1];
$newRank = $userDb['rank']; if ($deductScore>0){
$newScore = $userDb['score'] - $deductScore; $newRank = $userDb['rank'];
mt\Rank::calcNewRankAndScore( $newRank, $newScore); $newScore = $userDb['score'] - $deductScore;
$this->_updateUserInfo(array( mt\Rank::calcNewRankAndScore( $newRank, $newScore);
'rank' => $newRank, $this->_updateUserInfo(array(
'score' => $newScore, 'rank' => $newRank,
)); 'score' => $newScore,
));
}
} }
} }
} }