From 7e0e30cc6f9e978e9b287411bf08951d9ce0813a Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Tue, 12 Dec 2023 13:52:23 +0800 Subject: [PATCH] 1 --- webapp/controller/HeroController.class.php | 2 +- webapp/controller/MapController.class.php | 239 --------------------- 2 files changed, 1 insertion(+), 240 deletions(-) delete mode 100644 webapp/controller/MapController.class.php diff --git a/webapp/controller/HeroController.class.php b/webapp/controller/HeroController.class.php index 434bd933..5f375653 100644 --- a/webapp/controller/HeroController.class.php +++ b/webapp/controller/HeroController.class.php @@ -587,7 +587,7 @@ class HeroController extends BaseAuthedController { 英雄分解 */ public function heroSalvage(){ - + } /* diff --git a/webapp/controller/MapController.class.php b/webapp/controller/MapController.class.php deleted file mode 100644 index 6a4ab0d5..00000000 --- a/webapp/controller/MapController.class.php +++ /dev/null @@ -1,239 +0,0 @@ -_rspData(array( - 'data' => $chipList, - )); - } - - public function chipDetails(){ - $unique_id = trim(getReqVal('unique_id', 0)); - if (! $unique_id){ - $this->_rspErr(1, 'Please enter parameter unique_id'); - return ; - } - $chipDb = Chip::find($unique_id); - if (! $chipDb){ - $this->_rspErr(1, "You don't have the chip yet"); - return; - } - $chip = Chip::toDto($chipDb); - $this->_rspData(array( - 'data' => $chip, - )); - } - - public function upgradeLevelPreview(){ - $unique_id = trim(getReqVal('unique_id', 0)); - if (! $unique_id) { - $this->_rspErr(1, 'Please enter parameter unique_id'); - return; - } - $chipDb = Chip::find($unique_id); - if (!$chipDb){ - $this->_rspErr(1,'unique_id parameter error'); - return; - } - if ($chipDb['chip_grade'] == Chip::CHIP_LV_MAX){ - $this->_rspErr(1,' Level upper limit'); - return; - } - $paramMeta = mt\Parameter::getByName('chip_upgrade_cost'); - if (!$paramMeta){ - $this->_rspErr(1, ' parameter null'); - return; - } - $chip = Chip::toDto($chipDb); - $rand_attr = emptyReplace(json_decode($chipDb['rand_attr'], true), array()); - $chipMeta = mt\ChipAttr::getAttrByItemId($chipDb['item_id']); - if ($chipMeta){ - array_unshift($rand_attr,array( - 'attr_id'=>$chipMeta['attr_id'], - 'val' => $chipMeta['lv'.($chipDb['chip_grade']+1)] - )); - } - $chip['rand_attr_after'] = $rand_attr; - - $paramValue = explode('|',$paramMeta['param_value']); - $gold = 0; - $stone = 0; - switch ($chipDb['chip_grade']){ - case 1: { - $lv2 = explode(':',$paramValue[0]); - $gold = $lv2[0]; - $stone = $lv2[1]; - };break; - case 2: { - $lv3 = explode(':',$paramValue[1]); - $gold = $lv3[0]; - $stone = $lv3[1]; - };break; - } - - $chip['cost'] = array( - array( - 'item_id' => V_ITEM_GOLD, - 'item_num' => $gold - ), - array( - 'item_id' => V_ITEM_CHIP_META, - 'item_num' => $stone - ) - ); - $this->_rspData(array( - 'data' => $chip - )); - } - - public function selectChip(){ - $unique_id = trim(getReqVal('unique_id', 0)); - $idxArr = explode(' ',$unique_id); - if (count($idxArr)<0){ - $this->_rspErr(1, 'Please enter instructions'); - return; - } - $chipDbMain = Chip::find($idxArr[0]); - $chipDbParam = Chip::find($idxArr[1]); - if (!$chipDbMain || !$chipDbParam){ - $this->_rspErr(1,'unique_id parameter error'); - return; - } - if ($chipDbParam['token_id']) { - $this->_rspErr(1, "Unable to use nft chip"); - return; - } - if (!$chipDbParam['state']) { - $this->_rspErr(1, "Unable to use free chip"); - return; - } - if ($chipDbParam['chip_grade']>$chipDbMain['chip_grade']){ - $this->_rspErr(1, "The selected material is too high grade"); - return; - } - $cost = \services\FormulaService::getChipCumulativeCost($chipDbParam['chip_grade']); - $this->_rspData(['cost'=>$cost]); - } - - public function upgradeLevel(){ - $chipUniId = trim(getReqVal('chip_uniid', 0)); - if (!$chipUniId) { - $this->_rspErr(1, 'Please enter parameter'); - return; - } - $chipDb = Chip::find($chipUniId); - if (!$chipDb){ - $this->_rspErr(1,'unique_id_main parameter error'); - return; - } - if ($chipDb['chip_grade'] == Chip::CHIP_LV_MAX){ - $this->_rspErr(1,' Level upper limit'); - return; - } - - $paramMeta = mt\Parameter::getByName('chip_upgrade_cost'); - if (!$paramMeta){ - $this->_rspErr(1, ' parameter null'); - return; - } - $paramValue = explode('|',$paramMeta['param_value']); - $gold = 0; - $stone = 0; - switch ($chipDb['chip_grade']){ - case 1: { - $lv2 = explode(':',$paramValue[0]); - $gold = $lv2[0]; - $stone = $lv2[1]; - };break; - case 2: { - $lv3 = explode(':',$paramValue[1]); - $gold = $lv3[0]; - $stone = $lv3[1]; - };break; - } - - $costItems = array( - array( - 'item_id' => V_ITEM_GOLD, - 'item_num' => $gold - ), - array( - 'item_id' => V_ITEM_CHIP_META, - 'item_num' => $stone - ), - ); - $lackItem = null; - if (!$this->_hasEnoughItems($costItems, $lackItem)) { - $this->_rspErr(3, $this->_getLackItemErrMsg($lackItem)); - return; - } - $this->_decItems($costItems); -// Bag::decItem(V_ITEM_CHIP_META,$stone); - - { - //埋点 - $event = [ - 'name' => LogService::CHIP_LEVEL_UP, - 'val' => $gold - ]; - LogService::consumeGold($event); - } - - $propertyChgService = new services\PropertyChgService(); - $propertyChgService->addChip(); - $propertyChgService->addBagChg(); - $propertyChgService->addUserChg(); - $rand_attr = emptyReplace(json_decode($chipDb['rand_attr'], true), array()); - $attrProMeta = \mt\ChipAttr::getAttrPool($chipDb); - array_push($rand_attr,array( - 'attr_id'=>$attrProMeta['attr_id'], - 'val'=>$attrProMeta['val'], - )); - Chip::update2($chipUniId, - array( - 'chip_grade' => $chipDb['chip_grade']+1, - //'state' => Chip::GETED_STATE, - 'rand_attr' => json_encode($rand_attr), - ) - ); - $chipDbNew = Chip::toDto(Chip::find($chipUniId)); - $this->_rspData([ - 'data'=>$chipDbNew, - 'property_chg' => $propertyChgService->toDto(), - ]); - } - -}