Example #1
0
 public function actionIndex()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh('#contact');
     }
     if (Yii::$app->getRequest()->getQueryParam('hhash')) {
         //var_dump(CountryController::actionTestUnicValTable('app/commands/Matches',));
         $records = Matches::find()->select(["date, COUNT(date) as cnt"])->where('id > 70000')->groupBy('date')->orderBy('id')->all();
         foreach ($records as $rec) {
             echo $rec['cnt'] . " - " . $rec['date'] . PHP_EOL;
         }
         exit;
     }
     return $this->render('contact_lend', ['model' => $model]);
 }
Example #2
0
 /**
  * Статистика команд
  * @param $matches
  * @param $team
  * @return integer статус команды
  */
 public function teamsSummary($matches, $team, $from, $to)
 {
     $matchs = [];
     $is_club = 1;
     //echo TeamSum::find()->where("name like '".$team."'")->one()->is_club;
     try {
         if (TeamSum::find()->where("name like '" . $team . "'")->one()) {
             $is_club = TeamSum::find()->where("name like '" . $team . "'")->one()->is_club;
             if ($is_club) {
                 $grands = TeamSum::find()->where('is_tour_visual = 1 and is_club = 1')->all();
                 foreach ($grands as $grand) {
                     $matchs[$grand->name] = Matches::find()->orderBy('id DESC')->where("host like('_" . $grand->name . "') or guest like('" . $grand->name . "_') or (host like('_" . $grand->name . " (%') and host not like('_" . $grand->name . " (Б)%') ) or (guest like('" . $grand->name . " (%') and guest not like('" . $grand->name . " (Б)%'))")->andWhere("id > " . $from . " and id < " . $to . " ")->all();
                 }
             } else {
                 $grands = TeamSum::find()->where('is_tour_visual = 1 and is_club = 0')->all();
                 foreach ($grands as $grand) {
                     $matchs[$grand->name] = Matches::find()->orderBy('id DESC')->where("host like('_" . $grand->name . "') or guest like('" . $grand->name . "_') ")->andWhere("id > " . $from . " and id < " . $to . " ")->all();
                 }
             }
         }
     } catch (\ErrorException $e) {
         echo "mistake" . $e->getMessage();
     }
     $matchs[$team] = $matches;
     // var_dump($matchs);
     //var_dump($to);
     // exit;
     foreach ($matchs as $key => $mtch) {
         $team = TeamSum::find()->where("name like '" . $key . "'")->one();
         if (isset($team[0])) {
             $this->updateTeamData($team[0], $mtch);
         }
     }
     return $is_club;
 }
Example #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getFooMatch()
 {
     return $this->hasOne(Matches::className(), ['id' => 'foo_match_id']);
 }
Example #4
0
echo \app\components\BetChempionWidget::widget(['user_id' => isset($user->id) ? $user->id : 1]);
?>
</div>
<div class="view">
    <table class="table">
        <tbody>

        <?php 
$i = 0;
foreach ($predicted as $one) {
    $class = '';
    $title = '';
    ?>
            <?php 
    if ($one->match->foo_match_id > 1) {
        $mtch = \app\models\Matches::findOne($one->match->foo_match_id);
        if ($one->status == \app\models\Totpredict::STATUS_RIGHT_SCORE) {
            $class = 'green';
            $title = 'Угадан счет';
        } elseif ($one->status == \app\models\Totpredict::STATUS_RIGHT_RESULT) {
            $class = 'blue';
            $title = 'Угадан исход';
        } elseif ($one->status == \app\models\Totpredict::STATUS_BAD_PROGNOSE) {
            $class = 'red';
            $title = 'Прогноз не верен';
        }
        ?>
            <tr>
                <td><p class="progn""><?php 
        echo $mtch->date;
        ?>
Example #5
0
 function actionGrandTeamsSummary()
 {
     $from = 72736;
     $to = Matches::find()->select('MAX(id)')->scalar();
     $matchs = [];
     //$is_club = 1;
     //echo TeamSum::find()->where("name like '".$team."'")->one()->is_club;
     $grands = TeamSum::find()->where('is_tour_visual = 1')->all();
     foreach ($grands as $grand) {
         $matchs[$grand->name] = Matches::find()->orderBy('id DESC')->where("host like('_" . $grand->name . "') or guest like('" . $grand->name . "_') or (host like('_" . $grand->name . " (%') and host not like('_" . $grand->name . " (Б)%') ) or (guest like('" . $grand->name . " (%') and guest not like('" . $grand->name . " (Б)%'))")->andWhere("id > " . $from . " and id < " . $to . " ")->all();
     }
     //var_dump($matchs);
     //var_dump($to);
     // exit;
     foreach ($matchs as $key => $mtch) {
         $team = TeamSum::find()->where("name like '" . $key . "'")->one();
         if ($team) {
             echo $key . PHP_EOL;
             $team->cash_cout = count($mtch);
             $team->cash_vic = 0;
             $team->cash_nob = 0;
             $team->cash_def = 0;
             $team->cash_g_get = 0;
             $team->cash_g_let = 0;
             $team->cash_balls = 0;
             foreach ($mtch as $match) {
                 if (strstr($match->host, $key)) {
                     // $team->cash_cout = count($mtch);
                     //var_dump(strstr($match->host, $key)); exit;
                     if ($match->gett > $match->lett) {
                         $team->cash_vic += 1;
                         $team->cash_g_get += $match->gett;
                         $team->cash_g_let += $match->lett;
                         $team->cash_balls += 3;
                         //$team->update(false);
                     } elseif ($match->gett == $match->lett) {
                         $team->cash_nob += 1;
                         $team->cash_g_get += $match->gett;
                         $team->cash_g_let += $match->lett;
                         $team->cash_balls += 1;
                     } else {
                         $team->cash_def += 1;
                         $team->cash_g_get += $match->gett;
                         $team->cash_g_let += $match->lett;
                     }
                 } else {
                     if ($match->gett > $match->lett) {
                         $team->cash_def += 1;
                         $team->cash_g_let += $match->gett;
                         $team->cash_g_get += $match->lett;
                     } elseif ($match->gett == $match->lett) {
                         $team->cash_nob += 1;
                         $team->cash_g_let += $match->gett;
                         $team->cash_g_get += $match->lett;
                         $team->cash_balls += 1;
                     } else {
                         $team->cash_vic += 1;
                         $team->cash_g_let += $match->gett;
                         $team->cash_g_get += $match->lett;
                         $team->cash_balls += 3;
                     }
                 }
                 $team->update(false);
             }
         }
     }
 }