From 2d05964a22f3aff904f9ede6ff5755f29842cb4b Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 15 Oct 2024 14:26:54 +0800 Subject: [PATCH] 1 --- webapp/controller/BattleController.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index f53c7273..bcb0f006 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -995,6 +995,19 @@ class BattleController extends BaseAuthedController { $info['items'] = $data; } + public function useBattleItem() + { + $itemId = getReqVal('item_id', 0); + $itemCount = Bag::getItemCount($itemId); + if ($itemCount > 0) { + Bag::decItem($itemId, 1); + } + myself()->_rspData(array( + 'item_id' => $itemId, + 'item_num' => max(0, $itemCount - 1), + )); + } + public function getMobaBattleData() { $sign = '';