From: Alexander Smirnov Date: Thu, 11 Jul 2024 11:44:42 +0000 (+0300) Subject: Добавлены даты границ опроса камер X-Git-Tag: 1.4~80^2~3 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=11583cf60c31e403b3ff501009583ae18edb53f7;p=erp24_rep%2Fyii-erp24%2F.git Добавлены даты границ опроса камер --- diff --git a/erp24/api1/views/cron/domru-cams.php b/erp24/api1/views/cron/domru-cams.php index 1498ad79..52298890 100644 --- a/erp24/api1/views/cron/domru-cams.php +++ b/erp24/api1/views/cron/domru-cams.php @@ -23,11 +23,10 @@ foreach($revers as $cam_id => $name) { } -//$tip=rand(0,4); - -$daysCnt = 2; -//if (isset($_GET["tip"])) $tip = (int)$_GET["tip"]; -if (!empty($_GET["daysCnt"])) $daysCnt = (int)$_GET["daysCnt"]; +$date1 = date('Y-m-d', strtotime('-1 day', time())); +$date2 = date('Y-m-d'); +if (!empty($_GET["date1"])) $date1 = $_GET['date1']; +if (!empty($_GET["date2"])) $date2 = $_GET['date2']; foreach (range(0,4) as $tip){ @@ -91,14 +90,16 @@ foreach (range(0,4) as $tip){ - echo "За дней $daysCnt"; + //echo "За дней $daysCnt"; + echo "С $date1 по $date2"; - for ($Offset = 0; $Offset <= $daysCnt; $Offset++) { + $currDate = $date1; + while ($currDate <= $date2) { $array = array( 'SessionID' => $sid, 'Analytics' => 'CrossingLine', - 'From' => date("Y-m-d 00:00:00", time() - 86400 * ($Offset)), - 'To' => date("Y-m-d 23:59:59", time() - 86400 * ($Offset - 1)), + 'From' => date("Y-m-d 00:00:00", strtotime($currDate)), + 'To' => date("Y-m-d 23:59:59", strtotime($currDate)), 'Direction' => 'Out', 'GroupBy' => 'hour', 'Limit' => 1000 @@ -117,7 +118,7 @@ foreach (range(0,4) as $tip){ //echo $html; - $file_put = __DIR__ . "/../../log/xml/ExportReport" . $acc . "_" . $Offset . ".xml"; + $file_put = __DIR__ . "/../../log/xml/ExportReport" . $acc . "_" . $currDate . ".xml"; file_put_contents($file_put, $html); //echo""; @@ -206,11 +207,13 @@ foreach (range(0,4) as $tip){ $filename = 'file_cnt.txt'; - file_put_contents(__DIR__ . '/../../log/text/' . $filename, $Offset . "" . date("Y-m-d H:i:s") . ""); + file_put_contents(__DIR__ . '/../../log/text/' . $filename, $currDate . "" . date("Y-m-d H:i:s") . ""); if ($all) { arsort($all); foreach ($all as $cid => $val) echo "
$cid = > $val "; ///".$allcnt[$cid]." } + + $currDate = date("Y-m-d", strtotime("+1 day", strtotime($currDate))); } sleep(2); }