$sql_template = "UPDATE tour_groups SET was_closed = 1 ;";
$SQLResultTeams = SQL::getInstance()->query($sql_template);
if($SQLResultTeams instanceof ErrorPoint){
    return $SQLResultTeams;
}
*/
$sql_template = "DELETE FROM tour_groups;";
$SQLResultTeams = SQL::getInstance()->query($sql_template);
if ($SQLResultTeams instanceof ErrorPoint) {
    return $SQLResultTeams;
}
$sql_template = "DELETE FROM tour_groups_details;";
$SQLResultTeams = SQL::getInstance()->query($sql_template);
if ($SQLResultTeams instanceof ErrorPoint) {
    return $SQLResultTeams;
}
createTourGroups(TOUR_TYPE_VK, 0);
createTourGroupsByPlace(TOUR_TYPE_COUNTRY);
createTourGroupsByPlace(TOUR_TYPE_CITY);
createTourGroupsByPlace(TOUR_TYPE_UNI);
echo str_repeat(" ", strlen($startString)) . date("[Y-m-d H:i:s.m]") . " Finished " . PHP_EOL;
switch ($runningOn) {
    case 1:
        // Server
        system("php -f " . SYSTEM_PATH . "/utils/cron.playOffTourIII.php >> " . SYSTEM_PATH . "/_logs/cron.playOffTourIII.log");
        break;
    case 2:
        // Home
        include SYSTEM_PATH . "/utils/cron.playOffTourIII.php";
        break;
}
示例#2
0
function createTourGroupsByPlace($tourType)
{
    echo "createTourGroupsByPlace : " . $tourType . PHP_EOL;
    // todo
    switch ($tourType) {
        case TOUR_TYPE_COUNTRY:
            $sql_template = "SELECT DISTINCT(country) as place FROM teams WHERE country > 0 and tour_III > 0;";
            //        $sql_template = "SELECT DISTINCT(country) as place FROM teams WHERE vk_id = 100206819;";
            break;
        case TOUR_TYPE_CITY:
            $sql_template = "SELECT DISTINCT(city) as place FROM teams WHERE city > 0 and tour_III > 0 ;";
            //      $sql_template = "SELECT DISTINCT(city) as place FROM teams WHERE vk_id = 100206819;";
            break;
        case TOUR_TYPE_UNI:
            $sql_template = "SELECT DISTINCT(university) as place FROM teams WHERE university > 0 and tour_III > 0 ;";
            //     $sql_template = "SELECT DISTINCT(university) as place FROM teams WHERE vk_id = 100206819;";
            break;
    }
    $SQLResultTeams = SQL::getInstance()->query($sql_template);
    if ($SQLResultTeams instanceof ErrorPoint) {
        return $SQLResultTeams;
    }
    if ($SQLResultTeams->num_rows) {
        echo "Need to upgrade " . $SQLResultTeams->num_rows . " places " . PHP_EOL;
        while ($res = $SQLResultTeams->fetch_object()) {
            createTourGroups($tourType, $res->place);
        }
    }
}