1
This commit is contained in:
parent
37e6e4d462
commit
84c2c23ecd
@ -996,6 +996,24 @@ class BattleController extends BaseAuthedController {
|
|||||||
$key = 'dec.battle.item.' . $roomUuid . ':' . myself()->_getAccountId();
|
$key = 'dec.battle.item.' . $roomUuid . ':' . myself()->_getAccountId();
|
||||||
$data = $r->get($key);
|
$data = $r->get($key);
|
||||||
if (empty($data)) {
|
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 {
|
} else {
|
||||||
$info['items'] = json_decode($data, true);
|
$info['items'] = json_decode($data, true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user