示例#1
0
文件: player.php 项目: sherdog/wnd
 public function use_powerup($playerID)
 {
     Validate::player($playerID);
     $playerModel = new PlayerModel();
     if ($_POST['payload'] == 'true') {
         Log::add("Payload pre hash: " . print_r($_POST, true));
         $_POST['payload'] = Util::hashPost($_POST);
     }
     $remaining = $playerModel->removePowerup($playerID, $_POST['payload']);
     if ($remaining) {
         $response['status'] = 'ok';
         $response['player'] = object(array("powerups" => $remaining));
     } else {
         $response['status'] = 'error';
     }
     $this->printJson($response);
 }