Example #1
0
 public function init()
 {
     parent::init();
     $this->user_sum = Totpredict::getUsersBalls();
     $this->user_sum = Totuser::find()->orderBy('balance DESC')->all();
     //Totpredict::getUsersStatus();
 }
Example #2
0
 private function userIfUserLegal($cuser)
 {
     $max_id = Totuser::find()->select('MAX(id)')->scalar();
     $i = 0;
     while ($i <= $max_id) {
         $i++;
         if ($user = Totuser::findOne($i)) {
             if (md5($user->id) == $cuser) {
                 $this->current_user = $user;
                 return true;
             }
         }
     }
     return false;
 }
Example #3
0
 /**
  * Кешим в таблицу данные по каждому юзеру
  * @return bool
  * @throws \Exception
  */
 public static function getUsersStatus()
 {
     /*
     $zero_object = new Totpredict();
     $zero_object->cnt = 0;
     
     $users_status['bad'] = self::find()
         ->select(['user_id, status, COUNT(status) as cnt'])
         ->where(['status' => 1])
         ->groupBy('user_id')
         ->all();
     //var_dump($users_status); exit;
     $users_status['middle'] = self::find()
         ->select(['user_id, status, COUNT(status) as cnt'])
         ->where(['status' => 2])
         ->groupBy('user_id')
         ->all();
     $users_status['good'] = self::find()
         ->select(['user_id, status, COUNT(status) as cnt'])
         ->where(['status' => 3])
         ->groupBy('user_id')
         ->all();
     if(!isset($users_status['bad'])) $users_status['bad'] = $zero_object;
     if(!isset($users_status['middle'])) $users_status['middle'] = $zero_object;
     if(!isset($users_status['good'])) $users_status['good'] = $zero_object;
     */
     $users = Totuser::find()->all();
     // var_dump($users); exit;
     if (!$users) {
         return false;
     }
     foreach ($users as $user) {
         $user->balance = self::find()->select(['SUM(bet_balance)'])->where(['user_id' => $user->id])->scalar();
         $user->no_goal = self::find()->select(['COUNT(status) as cnt'])->where(['user_id' => $user->id, 'status' => 1])->scalar();
         $user->result = self::find()->select(['COUNT(status) as cnt'])->where(['user_id' => $user->id, 'status' => 2])->scalar();
         $user->precise = self::find()->select(['COUNT(status) as cnt'])->where(['user_id' => $user->id, 'status' => 3])->scalar();
         $user->update(false);
     }
     return true;
 }
Example #4
0
    <title><?php 
echo Html::encode($this->title);
?>
</title>
    <?php 
$this->head();
?>
</head>
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
NavBar::begin(['brandLabel' => 'Предскажи счет, ' . $this->context->current_user->name . ',<span style="color:yellow"> В твоём кошельке ' . round(\app\models\Totuser::findOne($this->context->current_user->id)->money) . ' Р</span>', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
echo Nav::widget(['options' => ['class' => 'navbar-nav navbar-right'], 'items' => [['label' => 'Группы', 'url' => ['default/']], ['label' => 'Статистика', 'url' => ['default/']]]]);
NavBar::end();
?>

    <div class="container">
        <?php 
echo Breadcrumbs::widget(['links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : []]);
?>
        <?php 
echo $content;
?>
    </div>
</div>

<footer class="footer">