diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 0e087fc3..f53c7273 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -967,7 +967,7 @@ class BattleController extends BaseAuthedController { } } if (count($member['battle_items']) > 0) { - $this->decBattleItems($r, $roomUuid, $info, $member); + $this->getBattleItems($r, $roomUuid, $info, $member); } } array_push($teamInfo['members'], $info); @@ -982,38 +982,17 @@ class BattleController extends BaseAuthedController { myself()->_rspData($data); } - private function decBattleItems($r, $roomUuid, &$info, $member) + private function getBattleItems($r, $roomUuid, &$info, $member) { - $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']) { - array_push($data, array( - 'item_id' => $item['item_id'], - 'item_num' => $item['item_num'], - )); - myself()->_decItems(array( - array( - 'item_id' => $item['item_id'], - 'item_num' => $item['item_num'], - ) - )); - } else { - array_push($data, array( - 'item_id' => $item['item_id'], - 'item_num' => 0, - )); - } - } - $r->setPx($key, json_encode($data), 1000 * 60 * 30); - $info['items'] = $data; - } else { - $info['items'] = json_decode($data, true); + $data = array(); + foreach ($member['battle_items'] as $item) { + $itemCount = Bag::getItemCount($item['item_id']); + array_push($data, array( + 'item_id' => $item['item_id'], + 'item_num' => $item['item_num'], + )); } - error_log(json_encode($info['items'])); + $info['items'] = $data; } public function getMobaBattleData()