Example #1
0
File: Bet.php Project: ksr10/bw
 protected function generateRuleBet($ruleService, $rule)
 {
     $nameParts = explode(' ', $rule['name']);
     $ratioRange = array_pop($nameParts);
     $ratioRangeParts = explode('-', $ratioRange);
     list($from, $to) = $ratioRangeParts;
     $to = (double) $to;
     $from = (double) $from;
     $users = $ruleService->getUsersByRule($rule['id']);
     $ratioService = new RatioService();
     foreach ($users as $user) {
         if ($user['status'] === Bet::USER_STATUS_ACTIVE) {
             $ratio = $ratioService->getRatioForBet($from, $to);
             if ($ratio) {
                 $this->saveBet($ratio, $user, $rule);
             }
         }
     }
 }
Example #2
0
File: ratio.php Project: ksr10/bw
<?php

use Bw\Api\Service\Ratio as RatioService;
$app->get('/pickup-ratio', function () use($app) {
    $ratioService = new RatioService();
    try {
        $ratioService->pickupRatio();
    } catch (\Exception $e) {
        file_put_contents($GLOBALS['root_dir'] . '/data/logs/exceptions.log', print_r($e->getMessage(), 1) . "\n", FILE_APPEND);
    }
});