db->createCommand($sql)->execute(); if(!$res){ $sql = "INSERT INTO `qimall_link_category` (`name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('mch', '多商户门店', '19', '1', NULL, '1', '1654741229', '1654741229');"; $this->execute($sql); } $sql = "select * from qimall_link_category where name = 'mch_cate'"; $res = $this->db->createCommand($sql)->execute(); if(!$res){ $sql = "INSERT INTO `qimall_link_category` (`name`, `title`, `pid`, `is_list`, `remark`, `status`, `created_at`, `updated_at`) VALUES ('mch_cate', '多商户门店分类', '19', '1', NULL, '1', '1654741255', '1654741345');"; $this->execute($sql); } } /** * {@inheritdoc} */ public function safeDown() { echo "M230708085948InsertLinkCategoryMch cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M230708085948InsertLinkCategoryMch cannot be reverted.\n"; return false; } */ }