diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index 2f4f5ce4..f6280d5a 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -288,31 +288,8 @@ class PassController extends BaseAuthedController public function buyLevel() { error_log("buyLevel : " . json_encode($_REQUEST)); -// if (!$this->_isValidAddress()) { -// $this->_rspErr(1, 'address is empty'); -// return; -// } - $level = getReqVal('level', ''); -// $price = getReqVal('price', ''); - $passMeta = \mt\BattlePass::find($level); - if (!$passMeta || $this->userInfo['level'] > $level ) { - $this->_rspErr(1, 'param level error or null'); - return; - } - $celPrice = ($passMeta['total_exp'] - $this->userInfo['exp']) * \mt\Parameter::getVal('battlepass_buy_lv_price', ''); -// if ($celPrice != $price) { -// $this->_rspErr(1, 'The price is wrong'); -// return; -// } -// $response = services\BlockChainService::gameItemMallBuy( -// Transaction::BUY_EXP_ACTION_TYPE, services\BlockChainService::formatCurrency($price), V_ITEM_EXP, $passMeta['total_exp'] - $this->userInfo['exp']); -// $this->_setV(TN_DAILY_BUY_LEVEL_STATE, 0, 1); -// BcOrder::upsert($response['trans_id'], array( -// 'item_id' => V_ITEM_EXP, -// 'item_num' => $passMeta['total_exp'] - $this->userInfo['exp'], -// 'price' => $price, -// )); - + $exp = getReqVal('exp', ''); + $celPrice = $exp * \mt\Parameter::getVal('battlepass_buy_lv_price', ''); //校验用户钻石数量 $costItems = array( array( @@ -327,14 +304,15 @@ class PassController extends BaseAuthedController } $this->_decItems($costItems); //提升通行证等级 - User::update(array( - 'exp' => $passMeta['total_exp'], - 'level' => $level, - )); - $this->userInfo = $this->_safeGetOrmUserInfo(); - //解锁至相应等级的奖励 - $this->_updatePassData(); + $items = array( + array( + 'item_id' => V_ITEM_EXP, + 'item_num' => $exp + ) + ); $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + $this->_addItems($items,$awardService,$propertyChgService); $propertyChgService->addUserChg(); $this->_rspData(array( 'property_chg' => $propertyChgService->toDto(),