1
This commit is contained in:
parent
c44384542b
commit
6ef91c03c5
@ -593,7 +593,8 @@ class BattleController extends BaseAuthedController {
|
||||
myself()->_rspErr(2, 'map mode error');
|
||||
return;
|
||||
}
|
||||
if (!$this->checkTicket($customData, $mapModeMeta)) {
|
||||
$r = myself()->_getRedis($roomUuid);
|
||||
if (!$this->checkTicket($r, $customData, $mapModeMeta)) {
|
||||
myself()->_rspErr(2, 'map mode error');
|
||||
return;
|
||||
}
|
||||
@ -683,7 +684,7 @@ class BattleController extends BaseAuthedController {
|
||||
array_push($data['team_list'], $teamInfo);
|
||||
}
|
||||
error_log(json_encode($data));
|
||||
$this->decTicket($customData, $mapModeMeta);
|
||||
$this->decTicket($r, $customData, $mapModeMeta);
|
||||
myself()->_rspData($data);
|
||||
}
|
||||
|
||||
@ -996,15 +997,20 @@ class BattleController extends BaseAuthedController {
|
||||
return $info;
|
||||
}
|
||||
|
||||
private function checkTicket($customData, $mapModeMeta)
|
||||
private function checkTicket($r, $customData, $mapModeMeta)
|
||||
{
|
||||
if (empty($mapModeMeta['admission_item_id'])) {
|
||||
$itemId = $mapModeMeta['admission_item_id'];
|
||||
if (empty($itemId)) {
|
||||
return true;
|
||||
}
|
||||
$roomUuid = $customData['room_uuid'];
|
||||
if ($r->get(DEC_BATTLE_TICKET . $roomUuid)) {
|
||||
return true;
|
||||
}
|
||||
foreach ($customData['team_list'] as $team) {
|
||||
foreach ($team['members'] as $member) {
|
||||
if (!$member['is_android']) {
|
||||
$itemDb = Bag::findEx($member['account_id'], $mapModeMeta['admission_item_id']);
|
||||
$itemDb = Bag::findEx($member['account_id'], $itemId);
|
||||
if (empty($itemDb) || $itemDb['item_num'] <= 0) {
|
||||
return false;
|
||||
}
|
||||
@ -1014,12 +1020,13 @@ class BattleController extends BaseAuthedController {
|
||||
return true;
|
||||
}
|
||||
|
||||
private function decTicket($customData, $mapModeMeta)
|
||||
private function decTicket($r, $customData, $mapModeMeta)
|
||||
{
|
||||
$itemId = $mapModeMeta['admission_item_id'];
|
||||
if (empty($itemId)) {
|
||||
return;
|
||||
}
|
||||
$roomUuid = $customData['room_uuid'];
|
||||
foreach ($customData['team_list'] as $team) {
|
||||
foreach ($team['members'] as $member) {
|
||||
if (!$member['is_android']) {
|
||||
@ -1030,6 +1037,7 @@ class BattleController extends BaseAuthedController {
|
||||
}
|
||||
}
|
||||
}
|
||||
$r->setNxPx(DEC_BATTLE_TICKET . $roomUuid, 1, 1000 * 3600);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user