From acaa7533bd869b8d9a004e74b398b51a426b9ffd Mon Sep 17 00:00:00 2001 From: fomichev Date: Tue, 24 Dec 2024 16:06:48 +0300 Subject: [PATCH] =?utf8?q?=D0=9F=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?utf8?q?=D0=BD=D0=B8=D0=B5=20=D0=91=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- erp24/config/console.php | 7 ++ erp24/config/db.php | 6 +- erp24/config/db2.php | 2 +- erp24/config/dev.console.config.php | 7 ++ erp24/config/prod.console.config.php | 7 ++ erp24/config/web.php | 7 ++ .../export-kogort.php | 69 +++++++++++++------ 7 files changed, 80 insertions(+), 25 deletions(-) diff --git a/erp24/config/console.php b/erp24/config/console.php index d75b8bf4..aeee0727 100755 --- a/erp24/config/console.php +++ b/erp24/config/console.php @@ -49,6 +49,13 @@ $config = [ ], ], 'db' => require dirname(__DIR__) . '/config/db.php', + 'dbRemote' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=194.147.78.221;port=3306;dbname=cms_test', + 'username' => 'ERP24_user', + 'password' => 'HJG6rtrhqaweruit*^%^2139487HUIG', + 'charset' => 'utf8mb4', + ], //'db2' => require dirname(__DIR__) . '/config/db2.php', ], 'params' => $params, diff --git a/erp24/config/db.php b/erp24/config/db.php index 1e278e47..05fc6002 100644 --- a/erp24/config/db.php +++ b/erp24/config/db.php @@ -14,11 +14,13 @@ return 1 == 1 ? [ 'class' => 'yii\db\pgsql\Schema', 'defaultSchema' => 'erp24' //specify your schema here, public is the default schema ] - ], // PostgreSQL + ], + 'on afterOpen' => function($event) { $event->sender->createCommand("SET search_path TO public, erp24;")->execute(); }, + // PostgreSQL // 'charset' => 'utf8', // 'enableSchemaCache' => true, // 'schemaCacheDuration' => 300, -]: [ +] : [ 'class' => yii\db\Connection::class, 'dsn' => strtr('mysql:host={host};port={port};dbname={dbname}', [ '{host}' => getenv('DB_HOST') ?: '127.0.0.1', diff --git a/erp24/config/db2.php b/erp24/config/db2.php index 77c668ed..2a538d6c 100644 --- a/erp24/config/db2.php +++ b/erp24/config/db2.php @@ -12,4 +12,4 @@ return [ 'charset' => 'utf8', 'enableSchemaCache' => true, 'schemaCacheDuration' => 300, -]; \ No newline at end of file +]; diff --git a/erp24/config/dev.console.config.php b/erp24/config/dev.console.config.php index 6ad81245..8e97d220 100755 --- a/erp24/config/dev.console.config.php +++ b/erp24/config/dev.console.config.php @@ -33,6 +33,13 @@ return [ 'showScriptName' => false, ], 'db' => require dirname(__DIR__) . '/config/db.php', + 'dbRemote' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=194.147.78.221;port=3306;dbname=cms_test', + 'username' => 'ERP24_user', + 'password' => 'HJG6rtrhqaweruit*^%^2139487HUIG', + 'charset' => 'utf8mb4', + ], //'db2' => require dirname(__DIR__) . '/config/db2.php', 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, diff --git a/erp24/config/prod.console.config.php b/erp24/config/prod.console.config.php index 3bef30b3..c40c778c 100755 --- a/erp24/config/prod.console.config.php +++ b/erp24/config/prod.console.config.php @@ -36,6 +36,13 @@ return [ 'showScriptName' => false, ], 'db' => require dirname(__DIR__) . '/config/db.php', + 'dbRemote' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=194.147.78.221;port=3306;dbname=cms_test', + 'username' => 'ERP24_user', + 'password' => 'HJG6rtrhqaweruit*^%^2139487HUIG', + 'charset' => 'utf8mb4', + ], //'db2' => require dirname(__DIR__) . '/config/db2.php', 'log' => [ 'traceLevel' => YII_DEBUG ? 3 : 0, diff --git a/erp24/config/web.php b/erp24/config/web.php index b4a1b6a8..13e66a2c 100644 --- a/erp24/config/web.php +++ b/erp24/config/web.php @@ -69,6 +69,13 @@ $config = [ ], ], 'db' => $db, + 'dbRemote' => [ + 'class' => 'yii\db\Connection', + 'dsn' => 'mysql:host=194.147.78.221;port=3306;dbname=cms_test', + 'username' => 'ERP24_user', + 'password' => 'HJG6rtrhqaweruit*^%^2139487HUIG', + 'charset' => 'utf8mb4', + ], 'urlManager' => [ 'enablePrettyUrl' => true, 'showScriptName' => false, diff --git a/erp24/views/users-message-management/export-kogort.php b/erp24/views/users-message-management/export-kogort.php index 264935bf..77916ac2 100644 --- a/erp24/views/users-message-management/export-kogort.php +++ b/erp24/views/users-message-management/export-kogort.php @@ -55,33 +55,58 @@ $this->title = 'Рассылка по когортам'; $columns): ?> - - - Таргет-.xlsx - - - Посмотреть - - + + + + Таргет-.xlsx + + + Посмотреть + + + - - - Whatsapp-.xlsx - - - Посмотреть - + + + + Whatsapp-.xlsx + + + Посмотреть + + + - - - Звонок-.xlsx - - - Посмотреть - + + + + Звонок-.xlsx + + + Посмотреть + + + + + dbRemote->createCommand("SELECT * FROM chatbot_telegram_users LIMIT 10") + ->queryAll(); + + foreach ($rows as $row) { + print_r($row); + } + +?> \ No newline at end of file -- 2.39.5