From: fomichev Date: Fri, 20 Dec 2024 13:22:49 +0000 (+0300) Subject: Создал таблицу sent_kogort и модель X-Git-Tag: 1.7~94^2~56 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=2296f0046bd917726f714926953feb3c42f9f477;p=erp24_rep%2Fyii-erp24%2F.git Создал таблицу sent_kogort и модель --- 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' => 'Дата создания записи', + ]; + } +}