$notify_message .= "безподобные результаты! В чемпионате ВКонтакта Вы заняли " . $teamObject->tour_place_vk . "-е место!";
        } else {
            if ($teamObject->tour_place_country) {
                $notify_message .= "просто великолепно! В чемпионате страны Вы заняли " . $teamObject->tour_place_country . "-е место!";
            } else {
                if ($teamObject->tour_place_city) {
                    $notify_message .= "радостные новости! В чемпионате города Вы заняли " . $teamObject->tour_place_city . "-е место!";
                } else {
                    $notify_message .= "хорошие результаты! В чемпионате ВУЗа Вы заняли " . $teamObject->tour_place_uni . "-е место!";
                }
            }
        }
        $notify_message .= " Примите наши поздравления и скидку чемпиона в размере " . ($bonus * 100 - 100) . "% на всех футболистов и тренеров";
        $notifyForUsers = array();
        $apiResult = NULL;
        $apiResult = $api->sendNotification($teamObject->vk_id, $notify_message);
        usleep(VK_MAILING_SPEED);
        /*      $teamId = $teamObject->vk_id; echo $teamId . "\n";
                $team = RAM::getInstance()->getTeamById($teamId);
                if(!empty($team)){
                    RAM::getInstance()->changeTeamField($teamId, 'tourBonus', $bonus);
                    RAM::getInstance()->changeTeamField($teamId, 'tourBonusTime', 0);
                }*/
    }
}
//////////////////// Это подготовка к новому //////////////////
TourSatellite::setTimerDate(time(), time() + 5 * 24 * 60 * 60, TOUR_NOTIFY_NEW);
$sql_template = "UPDATE teams SET tour_notify = " . TOUR_NOTIFY_NEW . ", tour_III = 0;";
// tour_III = 0
$SQLResultTeams = SQL::getInstance()->query($sql_template);
/*
     break;
 }
 $notifyForUsers = array();
 $apiResult = NULL;
 /*
         $notifyForUsers = "100206819";
         $apiResult = $api->sendNotification($notifyForUsers, $messageObject->notify_message);
 
         Utils::forDebug($apiResult);
 */
 if ($SQLresultTeam->num_rows) {
     while ($teamObject = $SQLresultTeam->fetch_object()) {
         $usersCount++;
         $notifyForUsers[] = $teamObject->vk_id;
         if (count($notifyForUsers) == 1000) {
             $apiResult = $api->sendNotification($notifyForUsers, $messageObject->notify_message);
             usleep(VK_MAILING_SPEED);
             if ($apiResult['error']) {
                 print "Error message!!!: " . $apiResult['error']['error_msg'] . ' !!!<br/>' . PHP_EOL;
                 $usersCount -= count($notifyForUsers);
             } else {
                 print "progress delivered for " . $usersCount . " users" . '<br/>' . PHP_EOL;
             }
             $notifyForUsers = array();
         }
     }
 }
 $sql_template = 'UPDATE notify SET notify_status = %d WHERE notify_id = ' . $messageObject->notify_id . ';';
 $sql = sprintf($sql_template, NOTIFY_STATUS_ENTED);
 $SQLresultTemp = SQL::getInstance()->query($sql);
 if ($SQLresultTemp instanceof ErrorPoint) {