From 72b983b7dba1f61b2b016359796c857ef3f1902d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 16 Oct 2024 17:00:35 +0800 Subject: [PATCH 1/4] 1 --- webapp/controller/BattleController.class.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index dfed480d..a74a5296 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -1019,6 +1019,11 @@ class BattleController extends BaseAuthedController { public function useBattleItem() { $itemId = getReqVal('item_id', 0); + $itemMeta = mt\Item::get($itemId); + if (!$itemMeta) { + $this->_rspErr(2, 'config error'); + return; + } $itemCount = Bag::getItemCount($itemId); if ($itemCount > 0) { Bag::decItem($itemId, 1); From 46f8bda768f8e55de01588ae7ed1ade06ff2a364 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 16 Oct 2024 17:05:00 +0800 Subject: [PATCH 2/4] 1 --- webapp/controller/BattleController.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index a74a5296..31ee7993 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -1422,9 +1422,9 @@ class BattleController extends BaseAuthedController { 'return_time' => myself()->_getNowTime(), ) ); - services\BattleBoxService::incAlreadyAllocBoxNum($row['phase'], - $row['createtime'], - -max(0, $allocBoxNum - $usedNum)); + services\BattleBoxService::incAlreadyAllocNum($row['phase'], + $row['createtime'], + -max(0, $allocBoxNum - $usedNum)); myself()->_rspOk(); } From c1373ae1a8839cdd9f421e0d40bbc9c53c813405 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 16 Oct 2024 17:07:10 +0800 Subject: [PATCH 3/4] 1 --- webapp/controller/UserController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index a3796dc7..cd7c4682 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -502,7 +502,8 @@ class UserController extends BaseAuthedController { 'item_id' => $itemId, 'item_num' => $itemNum, 'item_type' => $itemMeta['type'], - 'item_sub_type' => $itemMeta['sub_type'] + 'item_sub_type' => $itemMeta['sub_type'], + 'has_lucky_symbol' => myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol'), )); } else { myself()->_rspErr(1, 'item_id not found'); From 41d52fae3aacec617a9d866e6ddd45f4cb5c213f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 16 Oct 2024 17:25:51 +0800 Subject: [PATCH 4/4] 1 --- webapp/controller/UserController.class.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index cd7c4682..fb2ca844 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -498,12 +498,25 @@ class UserController extends BaseAuthedController { ) )) { $itemNum = myself()->_callModelStatic('Bag', 'getItemCount', $itemId); + $hasLuckySymbol = myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol'); + if ($itemMeta['type'] == mt\Item::FUNC_TYPE && + $itemMeta['sub_type'] == mt\Item::LUCKY_SYMBOL_SUBTYPE && + !$hasLuckySymbol) { + $this->_decItems(array( + array( + 'item_id' => $itemMeta['id'], + 'item_num' => 1 + ) + )); + myself()->_callModelStatic('LuckySymbol', 'add'); + $hasLuckySymbol = 1; + } myself()->_rspData(array( 'item_id' => $itemId, 'item_num' => $itemNum, 'item_type' => $itemMeta['type'], 'item_sub_type' => $itemMeta['sub_type'], - 'has_lucky_symbol' => myself()->_callModelStatic('LuckySymbol', 'hasLuckySymbol'), + 'has_lucky_symbol' => $hasLuckySymbol, )); } else { myself()->_rspErr(1, 'item_id not found');