]> gitweb.erp-flowers.ru Git - erp24_rep/yii-erp24/.git/commitdiff
[ERP-265] кнопка обновления текущего дня
authorAlexander Smirnov <fredeom@mail.ru>
Fri, 20 Dec 2024 18:04:11 +0000 (21:04 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Fri, 20 Dec 2024 18:04:11 +0000 (21:04 +0300)
erp24/modul/orders/delivery.php

index f9f7c1f5ae4f2bcb6cdd15f19f2a470d503bd1a8..1a15eec0b06cb4a17ac0aecc5d08db6a980a1812 100644 (file)
@@ -1,4 +1,25 @@
 <?php
+
+$action = $_GET['action'] ?? null;
+if ($action) {
+    $host = '';
+    if (str_contains($_SERVER['HTTP_HOST'], 'localhost')) {
+        $host = 'http://localhost:4444';
+    } else {
+        $host = 'https://api1.' . $_SERVER['HTTP_HOST'];
+    }
+    $host .= '/cron/amo142?date1=' . date('Y-m-d') . '&date2=' . date('Y-m-d') . '&status_id=142&key=getJH6GFi4tpU84YVPW9M__Xe_eQ24baWRFGl9ance&token_cloud=iC04295J9HyD2H3GJF3btky&grant_type=refresh_token&secret_phrase=VJJVkt467ltuXU__356XEtS';
+
+    $ch = curl_init($host);
+    curl_setopt($ch, CURLOPT_HEADER, 0);
+    curl_exec($ch);
+    if (curl_error($ch)) {
+        echo curl_error($ch);
+    }
+    curl_close($ch);
+    exit();
+}
+
 include_once(dirname(__DIR__, 2) . "/startup.php");
 include_once(dirname(__DIR__, 2) . "/inc/db.php");
 include_once(dirname(__DIR__, 2) . "/inc/base_new.php");
@@ -103,7 +124,7 @@ foreach($data as $row) {
 
 
 
-echo'<h1>Заказы из amo и чеки в магазинах <a href="/content/Amo142/?status_id=142&date1='.date("Y-m-d",time()).'&date2='.date("Y-m-d",time()).'" target=new class="btn btn-info">
+echo'<h1>Заказы из amo и чеки в магазинах <a href="/orders/delivery?action=amoUpdateToday" target="_blank" class="btn btn-info">
 импортировать заказы из amo с датой доставки '.date("d.m.Y",time()).'</a></h1>';