From 3e4ed099b1831fa7251eaefb40f0aed3d8e8d7b7 Mon Sep 17 00:00:00 2001 From: hujiabin <519660157@qq.com> Date: Fri, 21 Jun 2024 16:26:56 +0800 Subject: [PATCH] 1 --- webapp/controller/GMController.class.php | 33 ++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/webapp/controller/GMController.class.php b/webapp/controller/GMController.class.php index 205d48ea..f7af915a 100644 --- a/webapp/controller/GMController.class.php +++ b/webapp/controller/GMController.class.php @@ -10,9 +10,11 @@ require_once('services/PropertyChgService.php'); require_once('services/LootService.php'); require_once('services/MailApiService.php'); require_once('models/Nft.php'); +require_once('models/Hero.php'); use phpcommon\SqlHelper; use models\Nft; +use models\Hero; use phpcommon\TGLog; class GMController extends BaseAuthedController { @@ -60,6 +62,9 @@ class GMController extends BaseAuthedController { '.addtest' => function () use($params) { $this->addDyndata($params); }, + '.addhero' => function () use($params) { + $this->addHero($params); + }, '.loot' => function () use($params) { $this->lootTest($params); } @@ -107,6 +112,34 @@ END )); } + private function addHero($params) + { + $itemId = getXVal($params, 0, 0); + $quality = getXVal($params, 1, 1); + $propertyChgService = new services\PropertyChgService(); + $awardService = new services\AwardService(); + $itemMeta = mt\Item::get($itemId); + if (!$itemMeta){ + myself()->_rspErr(1, 'param item_id error'); + return; + } + if ($quality > 6){ + myself()->_rspErr(1, 'param quality error'); + return; + } + if ($itemMeta['type'] != \mt\Item::HERO_TYPE){ + myself()->_rspErr(1, 'param item_id error'); + return; + } + Hero::addSyntheticHero($itemMeta,$quality); + $propertyChgService->addHeroChg(); + $this->_rspData(array( + 'text' => 'add item success', + 'award' => $awardService->toDto(), + 'property_chg' => $propertyChgService->toDto(), + )); + } + private function addNft($params) { $itemId = getXVal($params, 0, 0);