From 41d52fae3aacec617a9d866e6ddd45f4cb5c213f Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 16 Oct 2024 17:25:51 +0800 Subject: [PATCH] 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');