From 56ff5f58566f04cf43f40c97df209dc8d588da90 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Mon, 27 Mar 2023 16:51:53 +0800 Subject: [PATCH] 1 --- webapp/controller/UserController.class.php | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 8f1d51cf..798bffc1 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -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, + )); + } + } } }