From edb4db10ca8af871020521d7761b0015677b86f7 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Mon, 3 Apr 2023 15:18:50 +0800 Subject: [PATCH] 1 --- .../controller/BaseAuthedController.class.php | 36 ++++++++++++++++++- webapp/mt/LevelUp.php | 11 +++--- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 8b339306..e39c56dc 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -82,7 +82,7 @@ class BaseAuthedController extends BaseController { die(); } } - + $this->_userLvRestriction(); /*if (SERVER_ENV == _ONLINE) { if (phpcommon\cmpVersion(getReqVal('_version', ''), '0.2.0') > 0) { if (!$this->isWhiteList() || myself()->_getChannel() != BC_CHANNEL) { @@ -93,6 +93,40 @@ class BaseAuthedController extends BaseController { }*/ } + private function _userLvRestriction(){ + $userDb = $this->_getOrmUserInfo(); + $controller = getReqVal('c', ''); + switch ($controller){ + case "Chip" : { + if ($userDb['level'] < \mt\LevelUp::USER_LEVEL_CHIP_LIMIT){ + $this->_rspErr(1,'Not agreed terms. Level of need ' .\mt\LevelUp::USER_LEVEL_CHIP_LIMIT); + die(); + } + } + break; + case "ChipPage" : { + if ($userDb['level'] < \mt\LevelUp::USER_LEVEL_CHIP_LIMIT){ + $this->_rspErr(1,'Not agreed terms Level of need ' .\mt\LevelUp::USER_LEVEL_CHIP_LIMIT); + die(); + } + } + break; + case "Emoji" : { + if ($userDb['level'] < \mt\LevelUp::USER_LEVEL_EMOJI_LIMIT){ + $this->_rspErr(1,'Not agreed terms Level of need ' .\mt\LevelUp::USER_LEVEL_EMOJI_LIMIT); + die(); + } + } + break; + case "Fragment" : { + if (getReqVal('a', '') == 'syntheticFragment' && $userDb['level'] < \mt\LevelUp::USER_LEVEL_PIECE_LIMIT){ + $this->_rspErr(1,'Not agreed terms Level of need ' .\mt\LevelUp::USER_LEVEL_PIECE_LIMIT); + die(); + } + } + } + } + protected function updateSession($accountId, $sessionId) { $r = $this->_getRedis($this->_getAccountId()); diff --git a/webapp/mt/LevelUp.php b/webapp/mt/LevelUp.php index 38ee5901..564b296b 100644 --- a/webapp/mt/LevelUp.php +++ b/webapp/mt/LevelUp.php @@ -8,11 +8,12 @@ class LevelUp { const USER_LEVEL_CHIP_LIMIT = 2; const USER_LEVEL_EMOJI_LIMIT = 3; - const USER_LEVEL_PVE_MATCH_LIMIT = 4; - const USER_LEVEL_RANK_MATCH_LIMIT = 6; - const USER_LEVEL_PARACHUTE_MATCH_LIMIT = 8; - const USER_LEVEL_CHIP_PAGE1_MATCH_LIMIT = 9; - const USER_LEVEL_CHIP_PAGE2_MATCH_LIMIT = 10; + const USER_LEVEL_PIECE_LIMIT = 4; + const USER_LEVEL_PVE_MATCH_LIMIT = 5; + const USER_LEVEL_RANK_MATCH_LIMIT = 7; + const USER_LEVEL_PARACHUTE_MATCH_LIMIT = 9; + const USER_LEVEL_CHIP_PAGE1_MATCH_LIMIT = 10; + const USER_LEVEL_CHIP_PAGE2_MATCH_LIMIT = 11; public static function getExpByLv(&$lv,&$exp){ $meta = self::getMetaList();