///ФИЛЬТРЫ $descr = ""; $price = $ss1['filt_price']; $dist1 = $ss1['filt_dist']; ///освободить ненужную память от массива. НУЖНО! $ss1 = $ss1['taxist_id']; //WORK STATUS ///установить на поиск... $sql = "UPDATE `taxist` SET `work`='4' WHERE `taxist_id`='" . $ss1 . "';"; db_req_without_resp($sql); /////инициализировать курл $ch = curl_init(); while (1) { ////найти 5 последних idriver_id показанных этому таксисту заказов..... $sql = "SELECT `id_tax` FROM `current_taxa_android` WHERE taxist_id='" . $ss1 . "' ORDER BY `id_taxa` DESC LIMIT 5"; $id_tax = db_reqs($sql); ///// взять два айди от 0,1 идекса массива данных, из псоледней итерации. $sql = "SELECT `last1`,`last2` FROM `last_indriver_id` WHERE taxist_id='" . $ss1 . "' AND `date` >= (now() - interval 5 minute);"; $last = db_req($sql); $last1 = $last['last1']; $last2 = $last['last2']; //////////////////////// ///GET GEO taxist /// //////////////////////// $sql = "SELECT `long`,`lat` FROM geoloc WHERE `taxist_id`='" . $ss1 . "' order by `time` DESC limit 1"; $ret = db_req($sql); $lat1 = $ret['lat']; $long1 = $ret['long']; //////////// ////curl//// ////////////
<?php require_once __DIR__ . "/../function/db.php"; $req = "SELECT `from`,`to`,`price`,`phone`,`username`,`priznak`,`date` FROM history LEFT JOIN taxist USING (taxist_id) ORDER BY history_id DESC;"; $ret = db_reqs($req); echo json_encode($ret);
<?php require_once "/var/www/indriver/function/db.php"; $reg = "SELECT * FROM history"; $ret = db_reqs($reg); foreach ($ret as $ss => $rrr) { if ($rrr[indriver_id] == 0) { $reg = "UPDATE history SET `indriver_id`={$ss} WHERE `history_id`={$rrr['history_id']}"; $ret = db_reqs($reg); } }
while (true) { $itter++; if ($itter >= $max_itter) { echo "off"; return; } //echo $itter; curl_setopt_array($ch, array(CURLOPT_NOBODY => 0, CURLOPT_RETURNTRANSFER => 1, CURLOPT_URL => "http://178.248.236.45/api/getlastorders", CURLOPT_POST => 1, CURLOPT_POSTFIELDS => $postdata, CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_TIMEOUT => 5, CURLOPT_HEADER => 0, CURLOPT_HTTPHEADER => $header)); $out = curl_exec($ch); $idd = json_decode($out); //print_r($idd); foreach ($idd->response->items as $s => $ss) { if ($idd->response->items[$s]->description == $descr) { if ($idd->response->items[$s]->price >= $price) { $req = "SELECT id_tax FROM current_taxa ORDER BY current_taxa_id DESC LIMIT 5;"; $id_tax = db_reqs($req); foreach ($id_tax as $is_id) { if ($is_id['id_tax'] != $idd->response->items[$s]->id) { $long22 = $idd->response->items[$s]->client->locationlongitude; $lat22 = $idd->response->items[$s]->client->locationlatitude; $lat2 = $idd->response->items[$s]->fromlatitude; $long2 = $idd->response->items[$s]->fromlongitude; if ($long22 == "" && $long2 == "") { continue; } else { if ($long22 == "") { } if ($long2 == "") { $lat2 = $lat22; $long2 = $long22; }
require_once "/var/www/indriver/function/db.php"; if (!is_null($_POST['id'])) { include "/var/www/indriver/modules/stop.php"; $req = "INSERT INTO history (`from`,`to`,`price`,`phone`,`taxist_id`, `indriver_id`) SELECT `from`,`to`,`price`,`phone`,{$_POST['id']},`id_tax` FROM current_taxa ORDER BY current_taxa_id DESC LIMIT 1"; db_req_without_resp($req); $req = "UPDATE `status` SET `init`='0' WHERE `status_id`='0';"; db_req_without_resp($req); echo "OK"; } if ($_POST['poziv'] == 1) { $ast = db_reqs("SELECT * FROM taxist WHERE work=1;"); echo json_encode($ast); } if ($_POST['poziv'] == 2) { $ast = db_reqs("SELECT * FROM taxist;"); foreach ($ast as $key => $val) { $ast1[$val['taxist_id']] = array('taxist_id' => $val['taxist_id'], 'username' => $val['username'], 'priznak' => $val['priznak'], 'work' => $val['work']); } echo json_encode($ast1); } if (!is_null($_POST['tax_work'])) { $ss = explode(":", $_POST['tax_work']); if ($ss[1] == 1) { $w = 0; } if ($ss[1] == 0) { $w = 1; } $req = "UPDATE `taxist` SET `work`={$w} WHERE `taxist_id`={$ss['0']};"; db_req_without_resp($req);
<?php require_once __DIR__ . "/../../function/db_api.php"; $a = "SELECT * FROM `polygon_current` LEFT JOIN `polygon` ON `polygon_current`.`polygon_name_id`=`polygon`.`polygon_name_id` LEFT JOIN `polygon_geo` ON `polygon`.`polygon_geo_id`=`polygon_geo`.`polygon_geo_id`"; $ss = db_reqs($a); foreach ($ss as $ss1) { $as[][$ss1['polygon_name_id']] = array($ss1['long'], $ss1['lat']); } print_r($as);