From 11583cf60c31e403b3ff501009583ae18edb53f7 Mon Sep 17 00:00:00 2001 From: Alexander Smirnov Date: Thu, 11 Jul 2024 14:44:42 +0300 Subject: [PATCH] =?utf8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?utf8?q?=D1=8B=20=D0=B4=D0=B0=D1=82=D1=8B=20=D0=B3=D1=80=D0=B0=D0=BD?= =?utf8?q?=D0=B8=D1=86=20=D0=BE=D0=BF=D1=80=D0=BE=D1=81=D0=B0=20=D0=BA?= =?utf8?q?=D0=B0=D0=BC=D0=B5=D1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/api1/views/cron/domru-cams.php | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) 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); } -- 2.39.5