Beispiel #1
0
 public function recordResultforRoll($leagueId, $lotteryId)
 {
     $isValidToken = User::checkAuth();
     $postedData = file_get_contents("php://input");
     $postedData = substr($postedData, 2, -2);
     $pinCount = explode(':', $postedData)[1];
     $jackpotAmount = Lottery::getCurrentJackpot($lotteryId);
     if ($isValidToken != 0) {
         $bowlerId = $isValidToken[0]->id;
         if ($pinCount == 10) {
             $winnerAmount = $jackpotAmount[0]->balence;
             $jackpot = Lottery::getstrike($lotteryId, $bowlerId, $winnerAmount);
             return \Response::json($jackpot, 200);
         } else {
             $winnerAmount = $jackpotAmount[0]->balence / 10;
             $jackpot = Lottery::getnonstrike($lotteryId, $bowlerId, $winnerAmount, $pinCount[0]);
             return \Response::json($jackpot, 200);
         }
     } else {
         return json_encode("Please enter valid Authentication Token");
     }
 }