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){
$userDb = $this->_getOrmUserInfo();
$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){
$valArr = explode('|',$paramMeta['param_value']);
$deductScore = $valArr[$rank_key-1];
$newRank = $userDb['rank'];
$newScore = $userDb['score'] - $deductScore;
mt\Rank::calcNewRankAndScore( $newRank, $newScore);
$this->_updateUserInfo(array(
'rank' => $newRank,
'score' => $newScore,
));
$param_value = explode('|',$paramMeta['param_value']);
$deductScore = $param_value[$rank_key-1];
if ($deductScore>0){
$newRank = $userDb['rank'];
$newScore = $userDb['score'] - $deductScore;
mt\Rank::calcNewRankAndScore( $newRank, $newScore);
$this->_updateUserInfo(array(
'rank' => $newRank,
'score' => $newScore,
));
}
}
}
}