コード例 #1
0
ファイル: routes.php プロジェクト: Headrun-php/TLG
     $inputs = Input::all();
     $term = $inputs['term'];
     $franchiseeId = Session::get('franchiseId');
     $result = DB::select('call sp_searchStudentCustomers(?, ?, ?)', array($term, $franchiseeId, '@result'));
     if (isset($result)) {
         return Response::json($result);
     }
     return Response::json(array("status" => "clear"));
 });
 Route::any('getWeekendsForBday', function () {
     $inputs = Input::all();
     $startDate = "01 " . $inputs['dateSelected'];
     $lastDateofMonth = date('t', strtotime($inputs['dateSelected']));
     $endDate = $lastDateofMonth . " " . $inputs['dateSelected'];
     $saturdays = getWeekends($startDate, $endDate, "Sat");
     $sundays = getWeekends($startDate, $endDate, "Sun");
     $result['saturdays'] = $saturdays;
     $result['sundays'] = $sundays;
     if (isset($result)) {
         return Response::json($result);
     }
     return Response::json(array("status" => "clear"));
 });
 Route::any('getCities', function () {
     $inputs = Input::all();
     $id = $inputs['id'];
     $countryCode = $inputs['countryCode'];
     $cities = Cities::getCities($id, $countryCode);
     return Response::json($cities);
 });
 Route::get('logout', "VaultController@logout");
コード例 #2
0
ファイル: test.php プロジェクト: akochnov/fts
<?php

error_reporting(-1);
ini_set('display_errors', 'On');
include_once 'aviasales.php';
$result = getWeekends();
echo print_r($result);
echo '</br></br>';
echo $result[0]['Friday'] . '</br>';
$date = new DateTime($result[0]['Friday']);
echo date('Y-m', $date->getTimestamp());
コード例 #3
0
ファイル: weekends.php プロジェクト: akochnov/fts
 * Date: 01.09.2015
 * Time: 15:20
 */
error_reporting(-1);
ini_set('display_errors', 'On');
set_time_limit(3600);
echo 'start</br>';
$timeStart = microtime(true);
require_once 'aviasales.php';
$origins = array('Москва', 'Санкт-Петербург');
//Destinations list from database
$destinations = getDestinations(5);
//Only include tariffs 80%+ cheaper then month average
$ratio = 0.7;
//Dates for next 6 months
$weekends = getWeekends(30);
//Table header
echo '<table>';
echo '<tr><th>Origin</th><th>Destination</th><th>Date</th><th>Days</th><th>Return at</th><th>Price</th><th>Average</th><th>Link</th></tr>';
$month = '';
foreach ($origins as $origin) {
    foreach ($destinations as $destination) {
        foreach ($weekends as $weekend) {
            foreach (array('Friday', 'Saturday') as $day) {
                //Get IATA codes
                $originIata = getCityCode($origin);
                $destIata = getCityCode($destination['destination_name']);
                if ($originIata && $destIata) {
                    //Define average rate for dest/month
                    $curMonth = date('Y-m', strtotime($weekend['Friday']));
                    if ($month != $curMonth) {