示例#1
0
文件: player.php 项目: sherdog/wnd
 public function coins($playerID)
 {
     Validate::player($playerID);
     if ($_POST['payload'] == 'true') {
         $_POST['payload'] = Util::hashPost($_POST);
     }
     if (!$_POST) {
         throw new NinjaException("Error in request");
     }
     if (!$_POST['payload']) {
         throw new NinjaException('No  data was received');
     }
     $data = str_replace(' ', '+', $_POST['payload']);
     $playerModel = new PlayerModel();
     if ($playerModel->updateCoins($playerID, $data)) {
         $response['status'] = 'ok';
     } else {
         $response['status'] = 'error';
         $response['message'] = "error updating player";
         Log::add('Error updating coins');
     }
     $this->printJson($response);
 }