execute($sql); $this->setExtraType(); } /** * {@inheritdoc} */ public function safeDown() { echo "M231014155312AleterQimallAddonsBossLevelSetting cannot be reverted.\n"; return false; } /** * 修改额外分红 * @return void */ public function setExtraType() { $i = 1; $page_size = 1000; while ($list = AddonsBossLevelSetting::find()->offset(($i - 1) * $page_size)->limit($page_size)->all()) { foreach ($list as $model) { if ($model->extra_type == 1) $model->extra_type = '["2"]'; if ($model->extra_type == 2) $model->extra_type = '["1"]'; if ($model->extra_type == 3) $model->extra_type = '["1","2","3"]'; $model->save(); } $i++; } } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M231014155312AleterQimallAddonsBossLevelSetting cannot be reverted.\n"; return false; } */ }