]> gitweb.erp-flowers.ru Git - yii-erp24/.git/commitdiff
add WIP cron/export-catalog during moving api1 to yii
authorAlexander Smirnov <fredeom@mail.ru>
Wed, 27 Dec 2023 18:28:11 +0000 (21:28 +0300)
committerAlexander Smirnov <fredeom@mail.ru>
Wed, 27 Dec 2023 18:28:11 +0000 (21:28 +0300)
erp24/api1/actions/cron/ExportCatalogAction.php [new file with mode: 0644]
erp24/api1/config/api1.config.php
erp24/api1/controllers/CronController.php
erp24/api1/views/cron/export-catalog.php [new file with mode: 0644]
erp24/inc/db2.php

diff --git a/erp24/api1/actions/cron/ExportCatalogAction.php b/erp24/api1/actions/cron/ExportCatalogAction.php
new file mode 100644 (file)
index 0000000..eaa5b9e
--- /dev/null
@@ -0,0 +1,13 @@
+<?php
+
+namespace app\actions\cron;
+
+use Yii;
+use yii\base\Action;
+
+class ExportCatalogAction extends Action
+{
+    public function run() {
+        return $this->controller->renderPartial('export-catalog');
+    }
+}
\ No newline at end of file
index d155d28e58a2e0690c956d68ddd479e696a7ee12..4216ef843b9c6d7ac63d6e23d691e84640527e9e 100644 (file)
@@ -64,6 +64,7 @@ return [
             'enableSession' => false,
         ],
         'db' => require __DIR__ . '/../../config/db.php',
+        'db2' => require __DIR__ . '/../../config/db2.php',
         'log' => [
             'traceLevel' => YII_DEBUG ? 3 : 0,
             'targets' => [
index 90d09de10e455cbcdce865907055ddeea1f30cbc..29921611246b05e21ff0b8d68b01b9562c32b56e 100644 (file)
@@ -16,6 +16,7 @@ class CronController extends BaseController
             '1c-sellers' => \app\actions\cron\OneCSellersAction::class,
             'custom-1c-cron' => \app\actions\cron\Custom1cCronAction::class,
             'balances-history' => \app\actions\cron\BalanceHistoryAction::class,
+            'export-catalog' => \app\actions\cron\ExportCatalogAction::class,
         ];
     }
 }
diff --git a/erp24/api1/views/cron/export-catalog.php b/erp24/api1/views/cron/export-catalog.php
new file mode 100644 (file)
index 0000000..dbe9ab8
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+
+if ($_REQUEST["token"] != "1CjgpXfgkh1pXV3KR2H57G3VtHCffrp154up1t36") { exit(); }
+
+include_once(dirname(__DIR__, 3) . "/startup.php");
+include_once(dirname(__DIR__, 3) . "/inc/db.php");
+include_once(dirname(__DIR__, 3) . "/inc/base_new.php");
+include_once(dirname(__DIR__, 3) . "/inc/db2.php");
+
+$data = Yii::$app->db->createCommand("SELECT entity_id, export_val FROM export_import_table WHERE entity='products' AND export_id='1'")->queryAll();
+foreach($data as $row) {
+    $export[$row["entity_id"]]=$row["export_val"];
+    if (isset($_GET["show"]) && $_GET["show"]==1) echo"<br> ".$row["entity_id"]." =".$row["export_val"]." ";
+}
+
+foreach($export as $entity_id => $export_val)
+{
+    if(!empty($export_val)) {
+
+//        Yii::$app->db2->createCommand("UPDATE info_items_table_shop_0 SET id_1c=:id_1c WHERE item_id=:item_id")
+//            ->bindValues([':id_1c' => $export_val, ':item_id' => $entity_id])->execute();
+
+        echo"<br> $export_val -$entity_id  ";
+    }
+}
index 74109f0b8429992308a8dde5f9413e5735191940..3d3245d7b0ff044c60a6ee59305cea9d627ca8f4 100644 (file)
@@ -171,10 +171,10 @@ protected $config2 = '';
 global $db2,$config2;
 
 $config2 = [
-    'DB_HOST' => '127.0.0.1',
+    'DB_HOST' => 'db-yii_erp24', // '127.0.0.1',
     'DB_USER' => 'bazacvetov24',
-    'DB_PASSWORD' => 'JVJruro_Xdg456o3ir',     
-    'DB_NAME' =>'bazacvetov24',        
+    'DB_PASSWORD' => 'JVJruro_Xdg456o3ir',
+    'DB_NAME' => 'erp24', // 'bazacvetov24',
     'CHARSET' => 'utf8',       
 ];