From: fomichev Date: Tue, 24 Dec 2024 13:06:48 +0000 (+0300) Subject: Подключение БД X-Git-Tag: 1.7~94^2~49 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=acaa7533bd869b8d9a004e74b398b51a426b9ffd;p=erp24_rep%2Fyii-erp24%2F.git Подключение БД --- 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