'2',// 类型[1=平台,2=商城] 'pid' => '38', 'title' => '短信日志', 'route' => 'mall/sms/index', 'icon' => '', 'authItemChild' => [// 子菜单权限,此参数若为空则表示无需增加子菜单权限) ] ] ]; $res = Menu::migrateCreateMenu($data); if ($res === false) throw new \Exception(Menu::getStaticError()); $sql = 'ALTER TABLE `qimall_sms_log` DROP INDEX `mall_id`, ADD INDEX `mall_id+ip`(`mall_id`, `ip`) USING BTREE, ADD INDEX `mall_id+mobile`(`mall_id`, `mobile`);'; $this->execute($sql); }catch (\Exception $e){ \Yii::error('迁移错误:' . $e->getMessage()); } } /** * {@inheritdoc} */ public function safeDown() { echo "M230713150123InsertQimallMenu cannot be reverted.\n"; return false; } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "M230713150123InsertQimallMenu cannot be reverted.\n"; return false; } */ }