diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index e6e2ea1e..fad5f9fb 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -6,6 +6,7 @@ require_once('models/Season.php'); require_once('models/Nft.php'); require_once('models/Gun.php'); require_once('models/UserSeasonRing.php'); +require_once('models/Chip.php'); require_once('mt/Parameter.php'); require_once('mt/Drop.php'); @@ -28,6 +29,7 @@ use models\Hero; use models\Gun; use models\Season; use models\Nft; +use models\Chip; use models\UserSeasonRing; class UserController extends BaseAuthedController { @@ -45,7 +47,7 @@ class UserController extends BaseAuthedController { $userInfo = $this->_safeGetOrmUserInfo(); if (!$userInfo) { $this->createNewUserV2($userName); - $this->_addFreeItem(); //送 50 Test_CEG + $this->_addFreeItem2(); //送 50 Test_CEG $userInfo = $this->_getOrmUserInfo(); $this->_setV(TN_RANK_STATUS, 0, 1); } @@ -62,6 +64,63 @@ class UserController extends BaseAuthedController { )); $this->_incDailyV(TN_DAILY_LOGINS, 0, 1); } + + private function _addFreeItem2(){ + //添加芯片 + $chipMeta = \mt\Item::getMetaListByType(\mt\Item::CHIP_TYPE); + $chip1 = array(); + $chip2 = array(); + $chip3 = array(); + foreach ($chipMeta as $row){ + if ($row['sub_type'] == 1){ + array_push($chip1,$row); + }else if($row['sub_type'] == 2){ + array_push($chip2,$row); + }else if($row['sub_type'] == 3){ + array_push($chip3,$row); + } + } + for ($i=1;$i<=20;$i++){ + $row1 = $chip1[array_rand($chip1)]; + Chip::addChip($row1); + $row2 = $chip2[array_rand($chip2)]; + Chip::addChip($row2); + $row3 = $chip3[array_rand($chip3)]; + Chip::addChip($row3); + } + //添加枪械和Gold + $addItems =array(); + foreach (mt\Parameter::getListValue('creator_present_items') as $itemsStr) { + list($itemId, $itemNum) = explode(':', $itemsStr); + if ($itemNum > 0) { + array_push($addItems, + array( + 'item_id' => $itemId, + 'item_num' => $itemNum + )); + } + } + array_push($addItems, + array( + 'item_id' => V_ITEM_GOLD, + 'item_num' => 100000 + )); + $awardService = new services\AwardService(); + $propertyChgService = new services\PropertyChgService(); + $this->_addItems($addItems, $awardService, $propertyChgService); + + //添加英雄和皮肤 + $itemIds = array(30700,30900,31000,40701,40702,40901,40902,41001); + $addItems2 =array(); + foreach ($itemIds as $row){ + array_push($addItems2, + array( + 'item_id' => $row, + 'item_num' => 1 + )); + } + $this->_addItems($addItems2, $awardService, $propertyChgService); + } private function addFragmentBox(){ $items = array(