1
This commit is contained in:
parent
8655dae204
commit
d2d194d6ad
@ -967,7 +967,7 @@ class BattleController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (count($member['battle_items']) > 0) {
|
if (count($member['battle_items']) > 0) {
|
||||||
$this->decBattleItems($r, $roomUuid, $info, $member);
|
$this->getBattleItems($r, $roomUuid, $info, $member);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
array_push($teamInfo['members'], $info);
|
array_push($teamInfo['members'], $info);
|
||||||
@ -982,38 +982,17 @@ class BattleController extends BaseAuthedController {
|
|||||||
myself()->_rspData($data);
|
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 = array();
|
||||||
$data = $r->get($key);
|
foreach ($member['battle_items'] as $item) {
|
||||||
if (empty($data)) {
|
$itemCount = Bag::getItemCount($item['item_id']);
|
||||||
$data = array();
|
array_push($data, array(
|
||||||
foreach ($member['battle_items'] as $item) {
|
'item_id' => $item['item_id'],
|
||||||
$itemCount = Bag::getItemCount($item['item_id']);
|
'item_num' => $item['item_num'],
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
error_log(json_encode($info['items']));
|
$info['items'] = $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getMobaBattleData()
|
public function getMobaBattleData()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user