Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DB::beginTransaction();
- $round = $this->lottery->getCurrentRound(Input::get('type'));
- $amount_to_spend = $amount - $amount%($threshold*1e8);//переводим порог в инт
- $this->currentUser->addToBalance(-$amount_to_spend);
- $this->currentUser->paymentHistory()->save(new PaymentHistory(['amount_btc' => -1 * $amount_to_spend, 'order_id'=>0,'comment' => 'Лотерея #' . $round->id, 'status' => 'confirmed']));
- $bet=$round->placeBet($this->currentUser->id, $amount_to_spend);
- $round->calcBetData($bet);
- $redis = L4Redis::connection();
- $redis->publish('lottery.bet', json_encode([
- 'bank' => $round->bank_int() + $bet->amount,
- 'round' => [
- 'id' => $round->id,
- 'bets'=>$round->bets->toArray()
- ],
- 'html' => View::make('lottery.bet',compact('bet'))->render(),
- ]));
- if($lottery_type == 'blitz' && $round->bets->count() === 9){//последняя ставка для блица
- $round = Round::findOrFail($round->id);
- $round->roundPay();//расчитываемся по прошедшему раунду
- $round->lottery->launchNewRound();//запускаем новый раунд
- }
- DB::commit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement