diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index d8f30fb3..0d25618a 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -996,6 +996,24 @@ class BattleController extends BaseAuthedController { $key = 'dec.battle.item.' . $roomUuid . ':' . myself()->_getAccountId(); $data = $r->get($key); if (empty($data)) { + $data = array(); + foreach ($member['battle_items'] as $item) { + $itemCount = Bag::getItemCount($item['item_id']); + if ($itemCount >= $item['item_num']) { + $data['item_id'] = $item['item_id']; + $data['item_num'] = $item['item_num']; + myself()->_decItems(array( + array( + 'item_id' => $item['item_id'], + 'item_num' => $item['item_num'], + ) + )); + } else { + $data['item_id'] = $item['item_id']; + $data['item_num'] = 0; + } + } + $r->setPx($key, json_encode($data), 1000 * 60 * 30); } else { $info['items'] = json_decode($data, true); }