From: Alexander Smirnov Date: Wed, 27 Dec 2023 18:28:11 +0000 (+0300) Subject: add WIP cron/export-catalog during moving api1 to yii X-Git-Tag: 1.1~195^2~4 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=9ae751a821bc87edc6604151f34f68ad953d7792;p=erp24_rep%2Fyii-erp24%2F.git add WIP cron/export-catalog during moving api1 to yii --- diff --git a/erp24/api1/actions/cron/ExportCatalogAction.php b/erp24/api1/actions/cron/ExportCatalogAction.php new file mode 100644 index 00000000..eaa5b9e3 --- /dev/null +++ b/erp24/api1/actions/cron/ExportCatalogAction.php @@ -0,0 +1,13 @@ +controller->renderPartial('export-catalog'); + } +} \ No newline at end of file diff --git a/erp24/api1/config/api1.config.php b/erp24/api1/config/api1.config.php index d155d28e..4216ef84 100644 --- a/erp24/api1/config/api1.config.php +++ b/erp24/api1/config/api1.config.php @@ -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' => [ diff --git a/erp24/api1/controllers/CronController.php b/erp24/api1/controllers/CronController.php index 90d09de1..29921611 100644 --- a/erp24/api1/controllers/CronController.php +++ b/erp24/api1/controllers/CronController.php @@ -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 index 00000000..dbe9ab86 --- /dev/null +++ b/erp24/api1/views/cron/export-catalog.php @@ -0,0 +1,25 @@ +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"
".$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"
$export_val -$entity_id "; + } +} diff --git a/erp24/inc/db2.php b/erp24/inc/db2.php index 74109f0b..3d3245d7 100644 --- a/erp24/inc/db2.php +++ b/erp24/inc/db2.php @@ -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', ];