]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
add cron/1c-sellers during moving api1 to yii
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 27 Dec 2023 14:06:53 +0000 (17:06 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 27 Dec 2023 14:06:53 +0000 (17:06 +0300)
erp24/api1/actions/cron/OneCSellersAction.php [new file with mode: 0644]
erp24/api1/controllers/CronController.php

diff --git a/erp24/api1/actions/cron/OneCSellersAction.php b/erp24/api1/actions/cron/OneCSellersAction.php
new file mode 100644 (file)
index 0000000..c06ef69
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+
+namespace app\actions\cron;
+
+use Yii;
+use yii\base\Action;
+use yii\db\Expression;
+
+class OneCSellersAction extends Action
+{
+    public function run() {
+
+        include_once(dirname(__DIR__, 3) . "/startup.php");
+        include_once(dirname(__DIR__, 3) . "/inc/db.php");
+
+        // api.bazacvetov24.ru/cron/1c.php?token_cloud=iC04295J9HyD2H3GJF3btky
+        if($_GET["token_cloud"]!="iC04295J9HyD2H3GJF3btky") exit();
+
+
+        $req_id=time();
+        $json_post='{"request_id": "'.$req_id.'","nomenclature":true,"sellers":true, "prices":{"type_price":"Розничная цена"}, "balances":true,  "payment_types":true}';
+
+        Yii::$app->db->createCommand()->insert('api_cron', [
+            'id' => 0,
+            'date' => new Expression('NOW()'),
+            'date_up' => new Expression('NOW()'),
+            'status' => 0,
+            'json_post' => $json_post,
+            'request_id' => $req_id
+        ])->execute();
+
+        return $this->controller->asJson(['response' => $req_id]);
+    }
+}
\ No newline at end of file
index e60d8f4f515c1f92ff95651f2b6a801c8519fd95..56ae34c559fb0d6d1ddcb3e71f8143f0d007fe6f 100644 (file)
@@ -13,6 +13,7 @@ class CronController extends BaseController
             'amo142' => \app\actions\cron\Amo142Action::class,
             'cloudpayments' => \app\actions\cron\CloudPaymentsAction::class,
             'domru-cams' => \app\actions\cron\DomRuCamsAction::class,
+            '1c-sellers' => \app\actions\cron\OneCSellersAction::class,
         ];
     }
 }