| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- <?php
- namespace app\migrations;
- use common\models\backend\Menu;
- use yii\db\Migration;
- /**
- * Class M240914091100InsertOrderLogAndUserLogMenu
- */
- class M240914091100InsertOrderLogAndUserLogMenu extends Migration
- {
- /**
- * {@inheritdoc}
- */
- public function safeUp()
- {
- try {
- $data = [
- [
- 'cate_id' => '2',// 类型[1=平台,2=商城]
- 'pid' => '38',
- 'title' => '日志记录',
- 'route' => 'mall/logs',
- 'icon' => '',
- // 子菜单权限,此参数若为空则表示无需增加子菜单权限)
- 'authItemChild' => []
- ],
- [
- 'cate_id' => '2',// 类型[1=平台,2=商城]
- 'pid' => '',
- 'title' => '会员记录',
- 'route' => 'mall/logs/user',
- 'icon' => '',
- 'p_route' => 'mall/logs',
- // 子菜单权限,此参数若为空则表示无需增加子菜单权限)
- 'authItemChild' => []
- ],
- [
- 'cate_id' => '2',// 类型[1=平台,2=商城]
- 'pid' => '33',
- 'title' => '订单日志',
- 'route' => 'mall/logs/order',
- 'icon' => '',
- // 子菜单权限,此参数若为空则表示无需增加子菜单权限)
- 'authItemChild' => []
- ],
- ];
- $res = Menu::migrateCreateMenu($data);
- if ($res === false) throw new \Exception(Menu::getStaticError());
- } catch (\Exception $e) {
- \Yii::error('迁移错误:' . $e->getMessage());
- }
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown()
- {
- return false;
- }
- /*
- // Use up()/down() to run migration code without a transaction.
- public function up()
- {
- }
- public function down()
- {
- echo "M240914091100InsertOrderLogAndUserLogMenu cannot be reverted.\n";
- return false;
- }
- */
- }
|