From 2296f0046bd917726f714926953feb3c42f9f477 Mon Sep 17 00:00:00 2001 From: fomichev Date: Fri, 20 Dec 2024 16:22:49 +0300 Subject: [PATCH] =?utf8?q?=D0=A1=D0=BE=D0=B7=D0=B4=D0=B0=D0=BB=20=D1=82?= =?utf8?q?=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=83=20sent=5Fkogort=20=D0=B8=20?= =?utf8?q?=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- ...241220_131428_create_sent_kogort_table.php | 42 +++++++++++++ erp24/records/SentKogort.php | 59 +++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 erp24/migrations/m241220_131428_create_sent_kogort_table.php create mode 100644 erp24/records/SentKogort.php diff --git a/erp24/migrations/m241220_131428_create_sent_kogort_table.php b/erp24/migrations/m241220_131428_create_sent_kogort_table.php new file mode 100644 index 00000000..80fb59dc --- /dev/null +++ b/erp24/migrations/m241220_131428_create_sent_kogort_table.php @@ -0,0 +1,42 @@ +db->getTableSchema(self::TABLE_NAME); + + if (!isset($tableSchema)) { + $this->createTable(self::TABLE_NAME, [ + 'id' => $this->primaryKey(), + 'phone' => $this->string(15)->notNull()->comment('Телефон пользователя'), + 'kogort_date' => $this->date()->notNull()->comment('Дата когорты'), + 'kogort_unixtime' => $this->integer()->notNull()->comment('UNIX-время когорты'), + 'status' => $this->tinyInteger(1)->notNull()->defaultValue(1)->comment('Вхождение в когорту'), + 'contact' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Контакт с клиентом'), + 'purchase' => $this->tinyInteger(1)->notNull()->defaultValue(0)->comment('Покупка'), + 'created_at' => $this->dateTime()->notNull()->comment('Дата создания записи'), + ]); + } + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $tableSchema = $this->db->getTableSchema(self::TABLE_NAME); + if (isset($tableSchema)) { + $this->dropTable(self::TABLE_NAME); + } + } +} diff --git a/erp24/records/SentKogort.php b/erp24/records/SentKogort.php new file mode 100644 index 00000000..575d59a8 --- /dev/null +++ b/erp24/records/SentKogort.php @@ -0,0 +1,59 @@ + null], + [['kogort_unixtime', 'status', 'contact', 'purchase'], 'integer'], + [['phone'], 'string', 'max' => 15], + ]; + } + + /** + * {@inheritdoc} + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'phone' => 'Телефон пользователя', + 'kogort_date' => 'Дата когорты', + 'kogort_unixtime' => 'UNIX-время когорты', + 'status' => 'Вхождение в когорту', + 'contact' => 'Контакт с клиентом', + 'purchase' => 'Покупка', + 'created_at' => 'Дата создания записи', + ]; + } +} -- 2.39.5